proteus  1.5.1
C/C++/Fortran libraries
subsurfaceTransportFunctions.c
Go to the documentation of this file.
1 /* Generated by Cython 0.25.2 */
2 
3 #define PY_SSIZE_T_CLEAN
4 #include "Python.h"
5 #ifndef Py_PYTHON_H
6  #error Python headers needed to compile C extensions, please install development version of Python.
7 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
8  #error Cython requires Python 2.6+ or Python 3.2+.
9 #else
10 #define CYTHON_ABI "0_25_2"
11 #include <stddef.h>
12 #ifndef offsetof
13  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
14 #endif
15 #if !defined(WIN32) && !defined(MS_WINDOWS)
16  #ifndef __stdcall
17  #define __stdcall
18  #endif
19  #ifndef __cdecl
20  #define __cdecl
21  #endif
22  #ifndef __fastcall
23  #define __fastcall
24  #endif
25 #endif
26 #ifndef DL_IMPORT
27  #define DL_IMPORT(t) t
28 #endif
29 #ifndef DL_EXPORT
30  #define DL_EXPORT(t) t
31 #endif
32 #ifndef HAVE_LONG_LONG
33  #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000)
34  #define HAVE_LONG_LONG
35  #endif
36 #endif
37 #ifndef PY_LONG_LONG
38  #define PY_LONG_LONG LONG_LONG
39 #endif
40 #ifndef Py_HUGE_VAL
41  #define Py_HUGE_VAL HUGE_VAL
42 #endif
43 #ifdef PYPY_VERSION
44  #define CYTHON_COMPILING_IN_PYPY 1
45  #define CYTHON_COMPILING_IN_PYSTON 0
46  #define CYTHON_COMPILING_IN_CPYTHON 0
47  #undef CYTHON_USE_TYPE_SLOTS
48  #define CYTHON_USE_TYPE_SLOTS 0
49  #undef CYTHON_USE_ASYNC_SLOTS
50  #define CYTHON_USE_ASYNC_SLOTS 0
51  #undef CYTHON_USE_PYLIST_INTERNALS
52  #define CYTHON_USE_PYLIST_INTERNALS 0
53  #undef CYTHON_USE_UNICODE_INTERNALS
54  #define CYTHON_USE_UNICODE_INTERNALS 0
55  #undef CYTHON_USE_UNICODE_WRITER
56  #define CYTHON_USE_UNICODE_WRITER 0
57  #undef CYTHON_USE_PYLONG_INTERNALS
58  #define CYTHON_USE_PYLONG_INTERNALS 0
59  #undef CYTHON_AVOID_BORROWED_REFS
60  #define CYTHON_AVOID_BORROWED_REFS 1
61  #undef CYTHON_ASSUME_SAFE_MACROS
62  #define CYTHON_ASSUME_SAFE_MACROS 0
63  #undef CYTHON_UNPACK_METHODS
64  #define CYTHON_UNPACK_METHODS 0
65  #undef CYTHON_FAST_THREAD_STATE
66  #define CYTHON_FAST_THREAD_STATE 0
67  #undef CYTHON_FAST_PYCALL
68  #define CYTHON_FAST_PYCALL 0
69 #elif defined(PYSTON_VERSION)
70  #define CYTHON_COMPILING_IN_PYPY 0
71  #define CYTHON_COMPILING_IN_PYSTON 1
72  #define CYTHON_COMPILING_IN_CPYTHON 0
73  #ifndef CYTHON_USE_TYPE_SLOTS
74  #define CYTHON_USE_TYPE_SLOTS 1
75  #endif
76  #undef CYTHON_USE_ASYNC_SLOTS
77  #define CYTHON_USE_ASYNC_SLOTS 0
78  #undef CYTHON_USE_PYLIST_INTERNALS
79  #define CYTHON_USE_PYLIST_INTERNALS 0
80  #ifndef CYTHON_USE_UNICODE_INTERNALS
81  #define CYTHON_USE_UNICODE_INTERNALS 1
82  #endif
83  #undef CYTHON_USE_UNICODE_WRITER
84  #define CYTHON_USE_UNICODE_WRITER 0
85  #undef CYTHON_USE_PYLONG_INTERNALS
86  #define CYTHON_USE_PYLONG_INTERNALS 0
87  #ifndef CYTHON_AVOID_BORROWED_REFS
88  #define CYTHON_AVOID_BORROWED_REFS 0
89  #endif
90  #ifndef CYTHON_ASSUME_SAFE_MACROS
91  #define CYTHON_ASSUME_SAFE_MACROS 1
92  #endif
93  #ifndef CYTHON_UNPACK_METHODS
94  #define CYTHON_UNPACK_METHODS 1
95  #endif
96  #undef CYTHON_FAST_THREAD_STATE
97  #define CYTHON_FAST_THREAD_STATE 0
98  #undef CYTHON_FAST_PYCALL
99  #define CYTHON_FAST_PYCALL 0
100 #else
101  #define CYTHON_COMPILING_IN_PYPY 0
102  #define CYTHON_COMPILING_IN_PYSTON 0
103  #define CYTHON_COMPILING_IN_CPYTHON 1
104  #ifndef CYTHON_USE_TYPE_SLOTS
105  #define CYTHON_USE_TYPE_SLOTS 1
106  #endif
107  #if PY_MAJOR_VERSION < 3
108  #undef CYTHON_USE_ASYNC_SLOTS
109  #define CYTHON_USE_ASYNC_SLOTS 0
110  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
111  #define CYTHON_USE_ASYNC_SLOTS 1
112  #endif
113  #if PY_VERSION_HEX < 0x02070000
114  #undef CYTHON_USE_PYLONG_INTERNALS
115  #define CYTHON_USE_PYLONG_INTERNALS 0
116  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
117  #define CYTHON_USE_PYLONG_INTERNALS 1
118  #endif
119  #ifndef CYTHON_USE_PYLIST_INTERNALS
120  #define CYTHON_USE_PYLIST_INTERNALS 1
121  #endif
122  #ifndef CYTHON_USE_UNICODE_INTERNALS
123  #define CYTHON_USE_UNICODE_INTERNALS 1
124  #endif
125  #if PY_VERSION_HEX < 0x030300F0
126  #undef CYTHON_USE_UNICODE_WRITER
127  #define CYTHON_USE_UNICODE_WRITER 0
128  #elif !defined(CYTHON_USE_UNICODE_WRITER)
129  #define CYTHON_USE_UNICODE_WRITER 1
130  #endif
131  #ifndef CYTHON_AVOID_BORROWED_REFS
132  #define CYTHON_AVOID_BORROWED_REFS 0
133  #endif
134  #ifndef CYTHON_ASSUME_SAFE_MACROS
135  #define CYTHON_ASSUME_SAFE_MACROS 1
136  #endif
137  #ifndef CYTHON_UNPACK_METHODS
138  #define CYTHON_UNPACK_METHODS 1
139  #endif
140  #ifndef CYTHON_FAST_THREAD_STATE
141  #define CYTHON_FAST_THREAD_STATE 1
142  #endif
143  #ifndef CYTHON_FAST_PYCALL
144  #define CYTHON_FAST_PYCALL 1
145  #endif
146 #endif
147 #if !defined(CYTHON_FAST_PYCCALL)
148 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
149 #endif
150 #if CYTHON_USE_PYLONG_INTERNALS
151  #include "longintrepr.h"
152  #undef SHIFT
153  #undef BASE
154  #undef MASK
155 #endif
156 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
157  #define Py_OptimizeFlag 0
158 #endif
159 #define __PYX_BUILD_PY_SSIZE_T "n"
160 #define CYTHON_FORMAT_SSIZE_T "z"
161 #if PY_MAJOR_VERSION < 3
162  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
163  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
164  PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
165  #define __Pyx_DefaultClassType PyClass_Type
166 #else
167  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
168  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
169  PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
170  #define __Pyx_DefaultClassType PyType_Type
171 #endif
172 #ifndef Py_TPFLAGS_CHECKTYPES
173  #define Py_TPFLAGS_CHECKTYPES 0
174 #endif
175 #ifndef Py_TPFLAGS_HAVE_INDEX
176  #define Py_TPFLAGS_HAVE_INDEX 0
177 #endif
178 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
179  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
180 #endif
181 #ifndef Py_TPFLAGS_HAVE_FINALIZE
182  #define Py_TPFLAGS_HAVE_FINALIZE 0
183 #endif
184 #ifndef METH_FASTCALL
185  #define METH_FASTCALL 0x80
186  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args,
187  Py_ssize_t nargs, PyObject *kwnames);
188 #else
189  #define __Pyx_PyCFunctionFast _PyCFunctionFast
190 #endif
191 #if CYTHON_FAST_PYCCALL
192 #define __Pyx_PyFastCFunction_Check(func)\
193  ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)))))
194 #else
195 #define __Pyx_PyFastCFunction_Check(func) 0
196 #endif
197 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
198  #define CYTHON_PEP393_ENABLED 1
199  #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
200  0 : _PyUnicode_Ready((PyObject *)(op)))
201  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
202  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
203  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
204  #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
205  #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
206  #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
207  #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
208  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
209 #else
210  #define CYTHON_PEP393_ENABLED 0
211  #define PyUnicode_1BYTE_KIND 1
212  #define PyUnicode_2BYTE_KIND 2
213  #define PyUnicode_4BYTE_KIND 4
214  #define __Pyx_PyUnicode_READY(op) (0)
215  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
216  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
217  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
218  #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
219  #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
220  #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
221  #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
222  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
223 #endif
224 #if CYTHON_COMPILING_IN_PYPY
225  #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
226  #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
227 #else
228  #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
229  #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
230  PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
231 #endif
232 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
233  #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
234 #endif
235 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
236  #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
237 #endif
238 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
239  #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
240 #endif
241 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
242  #define PyObject_Malloc(s) PyMem_Malloc(s)
243  #define PyObject_Free(p) PyMem_Free(p)
244  #define PyObject_Realloc(p) PyMem_Realloc(p)
245 #endif
246 #if CYTHON_COMPILING_IN_PYSTON
247  #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
248  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
249 #else
250  #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
251  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
252 #endif
253 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
254 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
255 #if PY_MAJOR_VERSION >= 3
256  #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
257 #else
258  #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
259 #endif
260 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
261  #define PyObject_ASCII(o) PyObject_Repr(o)
262 #endif
263 #if PY_MAJOR_VERSION >= 3
264  #define PyBaseString_Type PyUnicode_Type
265  #define PyStringObject PyUnicodeObject
266  #define PyString_Type PyUnicode_Type
267  #define PyString_Check PyUnicode_Check
268  #define PyString_CheckExact PyUnicode_CheckExact
269 #endif
270 #if PY_MAJOR_VERSION >= 3
271  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
272  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
273 #else
274  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
275  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
276 #endif
277 #ifndef PySet_CheckExact
278  #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
279 #endif
280 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
281 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
282 #if PY_MAJOR_VERSION >= 3
283  #define PyIntObject PyLongObject
284  #define PyInt_Type PyLong_Type
285  #define PyInt_Check(op) PyLong_Check(op)
286  #define PyInt_CheckExact(op) PyLong_CheckExact(op)
287  #define PyInt_FromString PyLong_FromString
288  #define PyInt_FromUnicode PyLong_FromUnicode
289  #define PyInt_FromLong PyLong_FromLong
290  #define PyInt_FromSize_t PyLong_FromSize_t
291  #define PyInt_FromSsize_t PyLong_FromSsize_t
292  #define PyInt_AsLong PyLong_AsLong
293  #define PyInt_AS_LONG PyLong_AS_LONG
294  #define PyInt_AsSsize_t PyLong_AsSsize_t
295  #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
296  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
297  #define PyNumber_Int PyNumber_Long
298 #endif
299 #if PY_MAJOR_VERSION >= 3
300  #define PyBoolObject PyLongObject
301 #endif
302 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
303  #ifndef PyUnicode_InternFromString
304  #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
305  #endif
306 #endif
307 #if PY_VERSION_HEX < 0x030200A4
308  typedef long Py_hash_t;
309  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
310  #define __Pyx_PyInt_AsHash_t PyInt_AsLong
311 #else
312  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
313  #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
314 #endif
315 #if PY_MAJOR_VERSION >= 3
316  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
317 #else
318  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
319 #endif
320 #if CYTHON_USE_ASYNC_SLOTS
321  #if PY_VERSION_HEX >= 0x030500B1
322  #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
323  #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
324  #else
325  typedef struct {
326  unaryfunc am_await;
327  unaryfunc am_aiter;
328  unaryfunc am_anext;
329  } __Pyx_PyAsyncMethodsStruct;
330  #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
331  #endif
332 #else
333  #define __Pyx_PyType_AsAsync(obj) NULL
334 #endif
335 #ifndef CYTHON_RESTRICT
336  #if defined(__GNUC__)
337  #define CYTHON_RESTRICT __restrict__
338  #elif defined(_MSC_VER) && _MSC_VER >= 1400
339  #define CYTHON_RESTRICT __restrict
340  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
341  #define CYTHON_RESTRICT restrict
342  #else
343  #define CYTHON_RESTRICT
344  #endif
345 #endif
346 #ifndef CYTHON_UNUSED
347 # if defined(__GNUC__)
348 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
349 # define CYTHON_UNUSED __attribute__ ((__unused__))
350 # else
351 # define CYTHON_UNUSED
352 # endif
353 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
354 # define CYTHON_UNUSED __attribute__ ((__unused__))
355 # else
356 # define CYTHON_UNUSED
357 # endif
358 #endif
359 #ifndef CYTHON_MAYBE_UNUSED_VAR
360 # if defined(__cplusplus)
361  template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
362 # else
363 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
364 # endif
365 #endif
366 #ifndef CYTHON_NCP_UNUSED
367 # if CYTHON_COMPILING_IN_CPYTHON
368 # define CYTHON_NCP_UNUSED
369 # else
370 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
371 # endif
372 #endif
373 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
374 
375 #ifndef CYTHON_INLINE
376  #if defined(__clang__)
377  #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
378  #elif defined(__GNUC__)
379  #define CYTHON_INLINE __inline__
380  #elif defined(_MSC_VER)
381  #define CYTHON_INLINE __inline
382  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
383  #define CYTHON_INLINE inline
384  #else
385  #define CYTHON_INLINE
386  #endif
387 #endif
388 
389 #if defined(WIN32) || defined(MS_WINDOWS)
390  #define _USE_MATH_DEFINES
391 #endif
392 #include <math.h>
393 #ifdef NAN
394 #define __PYX_NAN() ((float) NAN)
395 #else
396 static CYTHON_INLINE float __PYX_NAN() {
397  float value;
398  memset(&value, 0xFF, sizeof(value));
399  return value;
400 }
401 #endif
402 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
403 #define __Pyx_truncl trunc
404 #else
405 #define __Pyx_truncl truncl
406 #endif
407 
408 
409 #define __PYX_ERR(f_index, lineno, Ln_error) \
410 { \
411  __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
412 }
413 
414 #if PY_MAJOR_VERSION >= 3
415  #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
416  #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
417 #else
418  #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
419  #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
420 #endif
421 
422 #ifndef __PYX_EXTERN_C
423  #ifdef __cplusplus
424  #define __PYX_EXTERN_C extern "C"
425  #else
426  #define __PYX_EXTERN_C extern
427  #endif
428 #endif
429 
430 #define __PYX_HAVE__subsurfaceTransportFunctions
431 #define __PYX_HAVE_API__subsurfaceTransportFunctions
432 #include <string.h>
433 #include <stdio.h>
434 #include <stdlib.h>
435 #include "numpy/arrayobject.h"
436 #include "numpy/ufuncobject.h"
437 #include "math.h"
438 #ifdef _OPENMP
439 #include <omp.h>
440 #endif /* _OPENMP */
441 
442 #ifdef PYREX_WITHOUT_ASSERTIONS
443 #define CYTHON_WITHOUT_ASSERTIONS
444 #endif
445 
446 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
447  const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
448 
449 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
450 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
451 #define __PYX_DEFAULT_STRING_ENCODING ""
452 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
453 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
454 #define __Pyx_uchar_cast(c) ((unsigned char)c)
455 #define __Pyx_long_cast(x) ((long)x)
456 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
457  (sizeof(type) < sizeof(Py_ssize_t)) ||\
458  (sizeof(type) > sizeof(Py_ssize_t) &&\
459  likely(v < (type)PY_SSIZE_T_MAX ||\
460  v == (type)PY_SSIZE_T_MAX) &&\
461  (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
462  v == (type)PY_SSIZE_T_MIN))) ||\
463  (sizeof(type) == sizeof(Py_ssize_t) &&\
464  (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
465  v == (type)PY_SSIZE_T_MAX))) )
466 #if defined (__cplusplus) && __cplusplus >= 201103L
467  #include <cstdlib>
468  #define __Pyx_sst_abs(value) std::abs(value)
469 #elif SIZEOF_INT >= SIZEOF_SIZE_T
470  #define __Pyx_sst_abs(value) abs(value)
471 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
472  #define __Pyx_sst_abs(value) labs(value)
473 #elif defined (_MSC_VER) && defined (_M_X64)
474  #define __Pyx_sst_abs(value) _abs64(value)
475 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
476  #define __Pyx_sst_abs(value) llabs(value)
477 #elif defined (__GNUC__)
478  #define __Pyx_sst_abs(value) __builtin_llabs(value)
479 #else
480  #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
481 #endif
482 static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
483 static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
484 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
485 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
486 #define __Pyx_PyBytes_FromString PyBytes_FromString
487 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
488 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
489 #if PY_MAJOR_VERSION < 3
490  #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
491  #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
492 #else
493  #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
494  #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
495 #endif
496 #define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
497 #define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
498 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
499 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
500 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
501 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
502 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
503 #if PY_MAJOR_VERSION < 3
504 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
505 {
506  const Py_UNICODE *u_end = u;
507  while (*u_end++) ;
508  return (size_t)(u_end - u - 1);
509 }
510 #else
511 #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
512 #endif
513 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
514 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
515 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
516 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
517 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
518 #define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
519 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
520 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
521 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
522 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
523 #if CYTHON_ASSUME_SAFE_MACROS
524 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
525 #else
526 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
527 #endif
528 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
529 #if PY_MAJOR_VERSION >= 3
530 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
531 #else
532 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
533 #endif
534 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
535 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
536 static int __Pyx_sys_getdefaultencoding_not_ascii;
537 static int __Pyx_init_sys_getdefaultencoding_params(void) {
538  PyObject* sys;
539  PyObject* default_encoding = NULL;
540  PyObject* ascii_chars_u = NULL;
541  PyObject* ascii_chars_b = NULL;
542  const char* default_encoding_c;
543  sys = PyImport_ImportModule("sys");
544  if (!sys) goto bad;
545  default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
546  Py_DECREF(sys);
547  if (!default_encoding) goto bad;
548  default_encoding_c = PyBytes_AsString(default_encoding);
549  if (!default_encoding_c) goto bad;
550  if (strcmp(default_encoding_c, "ascii") == 0) {
551  __Pyx_sys_getdefaultencoding_not_ascii = 0;
552  } else {
553  char ascii_chars[128];
554  int c;
555  for (c = 0; c < 128; c++) {
556  ascii_chars[c] = c;
557  }
558  __Pyx_sys_getdefaultencoding_not_ascii = 1;
559  ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
560  if (!ascii_chars_u) goto bad;
561  ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
562  if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
563  PyErr_Format(
564  PyExc_ValueError,
565  "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
566  default_encoding_c);
567  goto bad;
568  }
569  Py_DECREF(ascii_chars_u);
570  Py_DECREF(ascii_chars_b);
571  }
572  Py_DECREF(default_encoding);
573  return 0;
574 bad:
575  Py_XDECREF(default_encoding);
576  Py_XDECREF(ascii_chars_u);
577  Py_XDECREF(ascii_chars_b);
578  return -1;
579 }
580 #endif
581 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
582 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
583 #else
584 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
585 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
586 static char* __PYX_DEFAULT_STRING_ENCODING;
587 static int __Pyx_init_sys_getdefaultencoding_params(void) {
588  PyObject* sys;
589  PyObject* default_encoding = NULL;
590  char* default_encoding_c;
591  sys = PyImport_ImportModule("sys");
592  if (!sys) goto bad;
593  default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
594  Py_DECREF(sys);
595  if (!default_encoding) goto bad;
596  default_encoding_c = PyBytes_AsString(default_encoding);
597  if (!default_encoding_c) goto bad;
598  __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
599  if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
600  strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
601  Py_DECREF(default_encoding);
602  return 0;
603 bad:
604  Py_XDECREF(default_encoding);
605  return -1;
606 }
607 #endif
608 #endif
609 
610 
611 /* Test for GCC > 2.95 */
612 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
613  #define likely(x) __builtin_expect(!!(x), 1)
614  #define unlikely(x) __builtin_expect(!!(x), 0)
615 #else /* !__GNUC__ or GCC < 2.95 */
616  #define likely(x) (x)
617  #define unlikely(x) (x)
618 #endif /* __GNUC__ */
619 
620 static PyObject *__pyx_m;
621 static PyObject *__pyx_d;
622 static PyObject *__pyx_b;
623 static PyObject *__pyx_empty_tuple;
624 static PyObject *__pyx_empty_bytes;
625 static PyObject *__pyx_empty_unicode;
626 static int __pyx_lineno;
627 static int __pyx_clineno = 0;
628 static const char * __pyx_cfilenm= __FILE__;
629 static const char *__pyx_filename;
630 
631 /* Header.proto */
632 #if !defined(CYTHON_CCOMPLEX)
633  #if defined(__cplusplus)
634  #define CYTHON_CCOMPLEX 1
635  #elif defined(_Complex_I)
636  #define CYTHON_CCOMPLEX 1
637  #else
638  #define CYTHON_CCOMPLEX 0
639  #endif
640 #endif
641 #if CYTHON_CCOMPLEX
642  #ifdef __cplusplus
643  #include <complex>
644  #else
645  #include <complex.h>
646  #endif
647 #endif
648 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
649  #undef _Complex_I
650  #define _Complex_I 1.0fj
651 #endif
652 
653 
654 static const char *__pyx_f[] = {
655  "proteus/subsurfaceTransportFunctions.pyx",
656  "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd",
657  "linux2/lib/python2.7/site-packages/Cython/Includes/cpython/type.pxd",
658 };
659 /* BufferFormatStructs.proto */
660 #define IS_UNSIGNED(type) (((type) -1) > 0)
661 struct __Pyx_StructField_;
662 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
663 typedef struct {
664  const char* name;
665  struct __Pyx_StructField_* fields;
666  size_t size;
667  size_t arraysize[8];
668  int ndim;
669  char typegroup;
670  char is_unsigned;
671  int flags;
672 } __Pyx_TypeInfo;
673 typedef struct __Pyx_StructField_ {
674  __Pyx_TypeInfo* type;
675  const char* name;
676  size_t offset;
677 } __Pyx_StructField;
678 typedef struct {
679  __Pyx_StructField* field;
680  size_t parent_offset;
681 } __Pyx_BufFmt_StackElem;
682 typedef struct {
683  __Pyx_StructField root;
684  __Pyx_BufFmt_StackElem* head;
685  size_t fmt_offset;
686  size_t new_count, enc_count;
687  size_t struct_alignment;
688  int is_complex;
689  char enc_type;
690  char new_packmode;
691  char enc_packmode;
692  char is_valid_array;
693 } __Pyx_BufFmt_Context;
694 
695 
696 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":725
697  * # in Cython to enable them only on the right systems.
698  *
699  * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
700  * ctypedef npy_int16 int16_t
701  * ctypedef npy_int32 int32_t
702  */
703 typedef npy_int8 __pyx_t_5numpy_int8_t;
704 
705 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":726
706  *
707  * ctypedef npy_int8 int8_t
708  * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
709  * ctypedef npy_int32 int32_t
710  * ctypedef npy_int64 int64_t
711  */
712 typedef npy_int16 __pyx_t_5numpy_int16_t;
713 
714 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":727
715  * ctypedef npy_int8 int8_t
716  * ctypedef npy_int16 int16_t
717  * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
718  * ctypedef npy_int64 int64_t
719  * #ctypedef npy_int96 int96_t
720  */
721 typedef npy_int32 __pyx_t_5numpy_int32_t;
722 
723 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":728
724  * ctypedef npy_int16 int16_t
725  * ctypedef npy_int32 int32_t
726  * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
727  * #ctypedef npy_int96 int96_t
728  * #ctypedef npy_int128 int128_t
729  */
730 typedef npy_int64 __pyx_t_5numpy_int64_t;
731 
732 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":732
733  * #ctypedef npy_int128 int128_t
734  *
735  * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
736  * ctypedef npy_uint16 uint16_t
737  * ctypedef npy_uint32 uint32_t
738  */
739 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
740 
741 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":733
742  *
743  * ctypedef npy_uint8 uint8_t
744  * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
745  * ctypedef npy_uint32 uint32_t
746  * ctypedef npy_uint64 uint64_t
747  */
748 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
749 
750 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":734
751  * ctypedef npy_uint8 uint8_t
752  * ctypedef npy_uint16 uint16_t
753  * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
754  * ctypedef npy_uint64 uint64_t
755  * #ctypedef npy_uint96 uint96_t
756  */
757 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
758 
759 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":735
760  * ctypedef npy_uint16 uint16_t
761  * ctypedef npy_uint32 uint32_t
762  * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
763  * #ctypedef npy_uint96 uint96_t
764  * #ctypedef npy_uint128 uint128_t
765  */
766 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
767 
768 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":739
769  * #ctypedef npy_uint128 uint128_t
770  *
771  * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
772  * ctypedef npy_float64 float64_t
773  * #ctypedef npy_float80 float80_t
774  */
775 typedef npy_float32 __pyx_t_5numpy_float32_t;
776 
777 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":740
778  *
779  * ctypedef npy_float32 float32_t
780  * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
781  * #ctypedef npy_float80 float80_t
782  * #ctypedef npy_float128 float128_t
783  */
784 typedef npy_float64 __pyx_t_5numpy_float64_t;
785 
786 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":749
787  * # The int types are mapped a bit surprising --
788  * # numpy.int corresponds to 'l' and numpy.long to 'q'
789  * ctypedef npy_long int_t # <<<<<<<<<<<<<<
790  * ctypedef npy_longlong long_t
791  * ctypedef npy_longlong longlong_t
792  */
793 typedef npy_long __pyx_t_5numpy_int_t;
794 
795 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":750
796  * # numpy.int corresponds to 'l' and numpy.long to 'q'
797  * ctypedef npy_long int_t
798  * ctypedef npy_longlong long_t # <<<<<<<<<<<<<<
799  * ctypedef npy_longlong longlong_t
800  *
801  */
802 typedef npy_longlong __pyx_t_5numpy_long_t;
803 
804 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":751
805  * ctypedef npy_long int_t
806  * ctypedef npy_longlong long_t
807  * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
808  *
809  * ctypedef npy_ulong uint_t
810  */
811 typedef npy_longlong __pyx_t_5numpy_longlong_t;
812 
813 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":753
814  * ctypedef npy_longlong longlong_t
815  *
816  * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
817  * ctypedef npy_ulonglong ulong_t
818  * ctypedef npy_ulonglong ulonglong_t
819  */
820 typedef npy_ulong __pyx_t_5numpy_uint_t;
821 
822 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":754
823  *
824  * ctypedef npy_ulong uint_t
825  * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<<
826  * ctypedef npy_ulonglong ulonglong_t
827  *
828  */
829 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
830 
831 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":755
832  * ctypedef npy_ulong uint_t
833  * ctypedef npy_ulonglong ulong_t
834  * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
835  *
836  * ctypedef npy_intp intp_t
837  */
838 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
839 
840 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":757
841  * ctypedef npy_ulonglong ulonglong_t
842  *
843  * ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
844  * ctypedef npy_uintp uintp_t
845  *
846  */
847 typedef npy_intp __pyx_t_5numpy_intp_t;
848 
849 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":758
850  *
851  * ctypedef npy_intp intp_t
852  * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
853  *
854  * ctypedef npy_double float_t
855  */
856 typedef npy_uintp __pyx_t_5numpy_uintp_t;
857 
858 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":760
859  * ctypedef npy_uintp uintp_t
860  *
861  * ctypedef npy_double float_t # <<<<<<<<<<<<<<
862  * ctypedef npy_double double_t
863  * ctypedef npy_longdouble longdouble_t
864  */
865 typedef npy_double __pyx_t_5numpy_float_t;
866 
867 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":761
868  *
869  * ctypedef npy_double float_t
870  * ctypedef npy_double double_t # <<<<<<<<<<<<<<
871  * ctypedef npy_longdouble longdouble_t
872  *
873  */
874 typedef npy_double __pyx_t_5numpy_double_t;
875 
876 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":762
877  * ctypedef npy_double float_t
878  * ctypedef npy_double double_t
879  * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
880  *
881  * ctypedef npy_cfloat cfloat_t
882  */
883 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
884 
885 /* "subsurfaceTransportFunctions.pyx":14
886  * cdef inline double double_min(double a, double b): return a if a <= b else b
887  *
888  * ctypedef numpy.double_t DTYPE_t # <<<<<<<<<<<<<<
889  * #numpy.intc_t not in cython's numpy.pxd
890  * ctypedef int ITYPE_t
891  */
892 typedef __pyx_t_5numpy_double_t __pyx_t_28subsurfaceTransportFunctions_DTYPE_t;
893 
894 /* "subsurfaceTransportFunctions.pyx":16
895  * ctypedef numpy.double_t DTYPE_t
896  * #numpy.intc_t not in cython's numpy.pxd
897  * ctypedef int ITYPE_t # <<<<<<<<<<<<<<
898  *
899  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global,
900  */
901 typedef int __pyx_t_28subsurfaceTransportFunctions_ITYPE_t;
902 /* Declarations.proto */
903 #if CYTHON_CCOMPLEX
904  #ifdef __cplusplus
905  typedef ::std::complex< float > __pyx_t_float_complex;
906  #else
907  typedef float _Complex __pyx_t_float_complex;
908  #endif
909 #else
910  typedef struct { float real, imag; } __pyx_t_float_complex;
911 #endif
912 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
913 
914 /* Declarations.proto */
915 #if CYTHON_CCOMPLEX
916  #ifdef __cplusplus
917  typedef ::std::complex< double > __pyx_t_double_complex;
918  #else
919  typedef double _Complex __pyx_t_double_complex;
920  #endif
921 #else
922  typedef struct { double real, imag; } __pyx_t_double_complex;
923 #endif
924 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
925 
926 
927 /*--- Type declarations ---*/
928 
929 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":764
930  * ctypedef npy_longdouble longdouble_t
931  *
932  * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<<
933  * ctypedef npy_cdouble cdouble_t
934  * ctypedef npy_clongdouble clongdouble_t
935  */
936 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
937 
938 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":765
939  *
940  * ctypedef npy_cfloat cfloat_t
941  * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<<
942  * ctypedef npy_clongdouble clongdouble_t
943  *
944  */
945 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
946 
947 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":766
948  * ctypedef npy_cfloat cfloat_t
949  * ctypedef npy_cdouble cdouble_t
950  * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<<
951  *
952  * ctypedef npy_cdouble complex_t
953  */
954 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
955 
956 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":768
957  * ctypedef npy_clongdouble clongdouble_t
958  *
959  * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<<
960  *
961  * cdef inline object PyArray_MultiIterNew1(a):
962  */
963 typedef npy_cdouble __pyx_t_5numpy_complex_t;
964 
965 /* --- Runtime support code (head) --- */
966 /* Refnanny.proto */
967 #ifndef CYTHON_REFNANNY
968  #define CYTHON_REFNANNY 0
969 #endif
970 #if CYTHON_REFNANNY
971  typedef struct {
972  void (*INCREF)(void*, PyObject*, int);
973  void (*DECREF)(void*, PyObject*, int);
974  void (*GOTREF)(void*, PyObject*, int);
975  void (*GIVEREF)(void*, PyObject*, int);
976  void* (*SetupContext)(const char*, int, const char*);
977  void (*FinishContext)(void**);
978  } __Pyx_RefNannyAPIStruct;
979  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
980  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
981  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
982 #ifdef WITH_THREAD
983  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
984  if (acquire_gil) {\
985  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
986  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
987  PyGILState_Release(__pyx_gilstate_save);\
988  } else {\
989  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
990  }
991 #else
992  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
993  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
994 #endif
995  #define __Pyx_RefNannyFinishContext()\
996  __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
997  #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
998  #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
999  #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1000  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1001  #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1002  #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1003  #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1004  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1005 #else
1006  #define __Pyx_RefNannyDeclarations
1007  #define __Pyx_RefNannySetupContext(name, acquire_gil)
1008  #define __Pyx_RefNannyFinishContext()
1009  #define __Pyx_INCREF(r) Py_INCREF(r)
1010  #define __Pyx_DECREF(r) Py_DECREF(r)
1011  #define __Pyx_GOTREF(r)
1012  #define __Pyx_GIVEREF(r)
1013  #define __Pyx_XINCREF(r) Py_XINCREF(r)
1014  #define __Pyx_XDECREF(r) Py_XDECREF(r)
1015  #define __Pyx_XGOTREF(r)
1016  #define __Pyx_XGIVEREF(r)
1017 #endif
1018 #define __Pyx_XDECREF_SET(r, v) do {\
1019  PyObject *tmp = (PyObject *) r;\
1020  r = v; __Pyx_XDECREF(tmp);\
1021  } while (0)
1022 #define __Pyx_DECREF_SET(r, v) do {\
1023  PyObject *tmp = (PyObject *) r;\
1024  r = v; __Pyx_DECREF(tmp);\
1025  } while (0)
1026 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1027 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1028 
1029 /* PyObjectGetAttrStr.proto */
1030 #if CYTHON_USE_TYPE_SLOTS
1031 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
1032  PyTypeObject* tp = Py_TYPE(obj);
1033  if (likely(tp->tp_getattro))
1034  return tp->tp_getattro(obj, attr_name);
1035 #if PY_MAJOR_VERSION < 3
1036  if (likely(tp->tp_getattr))
1037  return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
1038 #endif
1039  return PyObject_GetAttr(obj, attr_name);
1040 }
1041 #else
1042 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1043 #endif
1044 
1045 /* GetBuiltinName.proto */
1046 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1047 
1048 /* RaiseArgTupleInvalid.proto */
1049 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1050  Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1051 
1052 /* RaiseDoubleKeywords.proto */
1053 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1054 
1055 /* ParseKeywords.proto */
1056 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1057  PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1058  const char* function_name);
1059 
1060 /* ArgTypeTest.proto */
1061 static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
1062  const char *name, int exact);
1063 
1064 /* BufferFormatCheck.proto */
1065 static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
1066  __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
1067 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
1068 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
1069 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
1070  __Pyx_BufFmt_StackElem* stack,
1071  __Pyx_TypeInfo* type); // PROTO
1072 
1073 /* BufferIndexError.proto */
1074 static void __Pyx_RaiseBufferIndexError(int axis);
1075 
1076 #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
1077 #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
1078 /* PyThreadStateGet.proto */
1079 #if CYTHON_FAST_THREAD_STATE
1080 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1081 #define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET();
1082 #else
1083 #define __Pyx_PyThreadState_declare
1084 #define __Pyx_PyThreadState_assign
1085 #endif
1086 
1087 /* PyErrFetchRestore.proto */
1088 #if CYTHON_FAST_THREAD_STATE
1089 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1090 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1091 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1092 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1093 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1094 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1095 #else
1096 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1097 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1098 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1099 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1100 #endif
1101 
1102 /* DictGetItem.proto */
1103 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1104 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
1105  PyObject *value;
1106  value = PyDict_GetItemWithError(d, key);
1107  if (unlikely(!value)) {
1108  if (!PyErr_Occurred()) {
1109  PyObject* args = PyTuple_Pack(1, key);
1110  if (likely(args))
1111  PyErr_SetObject(PyExc_KeyError, args);
1112  Py_XDECREF(args);
1113  }
1114  return NULL;
1115  }
1116  Py_INCREF(value);
1117  return value;
1118 }
1119 #else
1120  #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1121 #endif
1122 
1123 #define __Pyx_BufPtrStrided3d(type, buf, i0, s0, i1, s1, i2, s2) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2)
1124 /* PyFloatBinop.proto */
1125 #if !CYTHON_COMPILING_IN_PYPY
1126 static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, int inplace);
1127 #else
1128 #define __Pyx_PyFloat_AddObjC(op1, op2, floatval, inplace)\
1129  (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1130 #endif
1131 
1132 #define __Pyx_BufPtrStrided4d(type, buf, i0, s0, i1, s1, i2, s2, i3, s3) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2 + i3 * s3)
1133 /* PyFunctionFastCall.proto */
1134 #if CYTHON_FAST_PYCALL
1135 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1136  __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1137 #if 1 || PY_VERSION_HEX < 0x030600B1
1138 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs);
1139 #else
1140 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1141 #endif
1142 #endif
1143 
1144 /* PyCFunctionFastCall.proto */
1145 #if CYTHON_FAST_PYCCALL
1146 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1147 #else
1148 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1149 #endif
1150 
1151 /* PyObjectCall.proto */
1152 #if CYTHON_COMPILING_IN_CPYTHON
1153 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1154 #else
1155 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1156 #endif
1157 
1158 /* GetModuleGlobalName.proto */
1159 static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
1160 
1161 /* ExtTypeTest.proto */
1162 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1163 
1164 /* GetItemInt.proto */
1165 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1166  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1167  __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1168  (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1169  __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1170 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1171  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1172  __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1173  (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1174 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1175  int wraparound, int boundscheck);
1176 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1177  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1178  __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1179  (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1180 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1181  int wraparound, int boundscheck);
1182 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1183 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1184  int is_list, int wraparound, int boundscheck);
1185 
1186 /* PyObjectCallMethO.proto */
1187 #if CYTHON_COMPILING_IN_CPYTHON
1188 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1189 #endif
1190 
1191 /* PyObjectCallOneArg.proto */
1192 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1193 
1194 /* pyobject_as_double.proto */
1195 static double __Pyx__PyObject_AsDouble(PyObject* obj);
1196 #if CYTHON_COMPILING_IN_PYPY
1197 #define __Pyx_PyObject_AsDouble(obj)\
1198 (likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) :\
1199  likely(PyInt_CheckExact(obj)) ?\
1200  PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj))
1201 #else
1202 #define __Pyx_PyObject_AsDouble(obj)\
1203 ((likely(PyFloat_CheckExact(obj))) ?\
1204  PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
1205 #endif
1206 
1207 /* RaiseException.proto */
1208 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1209 
1210 /* RaiseTooManyValuesToUnpack.proto */
1211 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1212 
1213 /* RaiseNeedMoreValuesToUnpack.proto */
1214 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1215 
1216 /* RaiseNoneIterError.proto */
1217 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1218 
1219 /* SaveResetException.proto */
1220 #if CYTHON_FAST_THREAD_STATE
1221 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1222 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1223 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1224 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1225 #else
1226 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1227 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1228 #endif
1229 
1230 /* PyErrExceptionMatches.proto */
1231 #if CYTHON_FAST_THREAD_STATE
1232 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1233 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1234 #else
1235 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1236 #endif
1237 
1238 /* GetException.proto */
1239 #if CYTHON_FAST_THREAD_STATE
1240 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1241 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1242 #else
1243 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1244 #endif
1245 
1246 /* Import.proto */
1247 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1248 
1249 /* CodeObjectCache.proto */
1250 typedef struct {
1251  PyCodeObject* code_object;
1252  int code_line;
1253 } __Pyx_CodeObjectCacheEntry;
1254 struct __Pyx_CodeObjectCache {
1255  int count;
1256  int max_count;
1257  __Pyx_CodeObjectCacheEntry* entries;
1258 };
1259 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1260 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1261 static PyCodeObject *__pyx_find_code_object(int code_line);
1262 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1263 
1264 /* AddTraceback.proto */
1265 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1266  int py_line, const char *filename);
1267 
1268 /* BufferStructDeclare.proto */
1269 typedef struct {
1270  Py_ssize_t shape, strides, suboffsets;
1271 } __Pyx_Buf_DimInfo;
1272 typedef struct {
1273  size_t refcount;
1274  Py_buffer pybuffer;
1275 } __Pyx_Buffer;
1276 typedef struct {
1277  __Pyx_Buffer *rcbuffer;
1278  char *data;
1279  __Pyx_Buf_DimInfo diminfo[8];
1280 } __Pyx_LocalBuf_ND;
1281 
1282 #if PY_MAJOR_VERSION < 3
1283  static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
1284  static void __Pyx_ReleaseBuffer(Py_buffer *view);
1285 #else
1286  #define __Pyx_GetBuffer PyObject_GetBuffer
1287  #define __Pyx_ReleaseBuffer PyBuffer_Release
1288 #endif
1289 
1290 
1291 /* None.proto */
1292 static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0};
1293 static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1};
1294 
1295 /* CIntToPy.proto */
1296 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1297 
1298 /* CIntToPy.proto */
1299 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value);
1300 
1301 /* CIntToPy.proto */
1302 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1303 
1304 /* RealImag.proto */
1305 #if CYTHON_CCOMPLEX
1306  #ifdef __cplusplus
1307  #define __Pyx_CREAL(z) ((z).real())
1308  #define __Pyx_CIMAG(z) ((z).imag())
1309  #else
1310  #define __Pyx_CREAL(z) (__real__(z))
1311  #define __Pyx_CIMAG(z) (__imag__(z))
1312  #endif
1313 #else
1314  #define __Pyx_CREAL(z) ((z).real)
1315  #define __Pyx_CIMAG(z) ((z).imag)
1316 #endif
1317 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
1318  && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
1319  #define __Pyx_SET_CREAL(z,x) ((z).real(x))
1320  #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
1321 #else
1322  #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
1323  #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
1324 #endif
1325 
1326 /* Arithmetic.proto */
1327 #if CYTHON_CCOMPLEX
1328  #define __Pyx_c_eq_float(a, b) ((a)==(b))
1329  #define __Pyx_c_sum_float(a, b) ((a)+(b))
1330  #define __Pyx_c_diff_float(a, b) ((a)-(b))
1331  #define __Pyx_c_prod_float(a, b) ((a)*(b))
1332  #define __Pyx_c_quot_float(a, b) ((a)/(b))
1333  #define __Pyx_c_neg_float(a) (-(a))
1334  #ifdef __cplusplus
1335  #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
1336  #define __Pyx_c_conj_float(z) (::std::conj(z))
1337  #if 1
1338  #define __Pyx_c_abs_float(z) (::std::abs(z))
1339  #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
1340  #endif
1341  #else
1342  #define __Pyx_c_is_zero_float(z) ((z)==0)
1343  #define __Pyx_c_conj_float(z) (conjf(z))
1344  #if 1
1345  #define __Pyx_c_abs_float(z) (cabsf(z))
1346  #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
1347  #endif
1348  #endif
1349 #else
1350  static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
1351  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
1352  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
1353  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
1354  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
1355  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
1356  static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
1357  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
1358  #if 1
1359  static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
1360  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
1361  #endif
1362 #endif
1363 
1364 /* Arithmetic.proto */
1365 #if CYTHON_CCOMPLEX
1366  #define __Pyx_c_eq_double(a, b) ((a)==(b))
1367  #define __Pyx_c_sum_double(a, b) ((a)+(b))
1368  #define __Pyx_c_diff_double(a, b) ((a)-(b))
1369  #define __Pyx_c_prod_double(a, b) ((a)*(b))
1370  #define __Pyx_c_quot_double(a, b) ((a)/(b))
1371  #define __Pyx_c_neg_double(a) (-(a))
1372  #ifdef __cplusplus
1373  #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
1374  #define __Pyx_c_conj_double(z) (::std::conj(z))
1375  #if 1
1376  #define __Pyx_c_abs_double(z) (::std::abs(z))
1377  #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
1378  #endif
1379  #else
1380  #define __Pyx_c_is_zero_double(z) ((z)==0)
1381  #define __Pyx_c_conj_double(z) (conj(z))
1382  #if 1
1383  #define __Pyx_c_abs_double(z) (cabs(z))
1384  #define __Pyx_c_pow_double(a, b) (cpow(a, b))
1385  #endif
1386  #endif
1387 #else
1388  static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
1389  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
1390  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
1391  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
1392  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
1393  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
1394  static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
1395  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
1396  #if 1
1397  static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
1398  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
1399  #endif
1400 #endif
1401 
1402 /* CIntToPy.proto */
1403 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
1404 
1405 /* CIntFromPy.proto */
1406 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1407 
1408 /* CIntFromPy.proto */
1409 static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_As_Py_intptr_t(PyObject *);
1410 
1411 /* CIntFromPy.proto */
1412 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1413 
1414 /* CheckBinaryVersion.proto */
1415 static int __Pyx_check_binary_version(void);
1416 
1417 /* PyIdentifierFromString.proto */
1418 #if !defined(__Pyx_PyIdentifier_FromString)
1419 #if PY_MAJOR_VERSION < 3
1420  #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
1421 #else
1422  #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
1423 #endif
1424 #endif
1425 
1426 /* ModuleImport.proto */
1427 static PyObject *__Pyx_ImportModule(const char *name);
1428 
1429 /* TypeImport.proto */
1430 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);
1431 
1432 /* InitStrings.proto */
1433 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1434 
1435 
1436 /* Module declarations from 'cpython.buffer' */
1437 
1438 /* Module declarations from 'libc.string' */
1439 
1440 /* Module declarations from 'libc.stdio' */
1441 
1442 /* Module declarations from '__builtin__' */
1443 
1444 /* Module declarations from 'cpython.type' */
1445 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1446 
1447 /* Module declarations from 'cpython' */
1448 
1449 /* Module declarations from 'cpython.object' */
1450 
1451 /* Module declarations from 'cpython.ref' */
1452 
1453 /* Module declarations from 'libc.stdlib' */
1454 
1455 /* Module declarations from 'numpy' */
1456 
1457 /* Module declarations from 'numpy' */
1458 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
1459 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
1460 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
1461 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
1462 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
1463 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
1464 
1465 /* Module declarations from 'subsurfaceTransportFunctions' */
1466 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t = { "ITYPE_t", NULL, sizeof(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t), 0 };
1467 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t = { "DTYPE_t", NULL, sizeof(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t), { 0 }, 0, 'R', 0, 0 };
1468 #define __Pyx_MODULE_NAME "subsurfaceTransportFunctions"
1469 int __pyx_module_is_main_subsurfaceTransportFunctions = 0;
1470 
1471 /* Implementation of 'subsurfaceTransportFunctions' */
1472 static PyObject *__pyx_builtin_range;
1473 static PyObject *__pyx_builtin_ValueError;
1474 static PyObject *__pyx_builtin_RuntimeError;
1475 static PyObject *__pyx_builtin_ImportError;
1476 static const char __pyx_k_I[] = "I";
1477 static const char __pyx_k_J[] = "J";
1478 static const char __pyx_k_d[] = "d";
1479 static const char __pyx_k_i[] = "i";
1480 static const char __pyx_k_j[] = "j";
1481 static const char __pyx_k_k[] = "k";
1482 static const char __pyx_k_m[] = "m";
1483 static const char __pyx_k_n[] = "n";
1484 static const char __pyx_k_q[] = "q";
1485 static const char __pyx_k_t[] = "t";
1486 static const char __pyx_k_v[] = "v";
1487 static const char __pyx_k_w[] = "w";
1488 static const char __pyx_k_x[] = "x";
1489 static const char __pyx_k_dS[] = "dS";
1490 static const char __pyx_k_dV[] = "dV";
1491 static const char __pyx_k_df[] = "df";
1492 static const char __pyx_k_dm[] = "dm";
1493 static const char __pyx_k_eN[] = "eN";
1494 static const char __pyx_k_ii[] = "ii";
1495 static const char __pyx_k_kb[] = "kb";
1496 static const char __pyx_k_mt[] = "mt";
1497 static const char __pyx_k_nd[] = "nd";
1498 static const char __pyx_k_pi[] = "pi";
1499 static const char __pyx_k_xc[] = "xc";
1500 static const char __pyx_k_yc[] = "yc";
1501 static const char __pyx_k_KWr[] = "KWr";
1502 static const char __pyx_k_KWs[] = "KWs";
1503 static const char __pyx_k_dmt[] = "dmt";
1504 static const char __pyx_k_dot[] = "dot";
1505 static const char __pyx_k_ebN[] = "ebN";
1506 static const char __pyx_k_l2g[] = "l2g";
1507 static const char __pyx_k_nnz[] = "nnz";
1508 static const char __pyx_k_q_m[] = "q_m";
1509 static const char __pyx_k_q_r[] = "q_r";
1510 static const char __pyx_k_q_u[] = "q_u";
1511 static const char __pyx_k_q_x[] = "q_x";
1512 static const char __pyx_k_rho[] = "rho";
1513 static const char __pyx_k_sum[] = "sum";
1514 static const char __pyx_k_u_j[] = "u_j";
1515 static const char __pyx_k_vol[] = "vol";
1516 static const char __pyx_k_a_eN[] = "a_eN";
1517 static const char __pyx_k_a_up[] = "a_up";
1518 static const char __pyx_k_beta[] = "beta";
1519 static const char __pyx_k_ebNE[] = "ebNE";
1520 static const char __pyx_k_f_up[] = "f_up";
1521 static const char __pyx_k_flat[] = "flat";
1522 static const char __pyx_k_flux[] = "flux";
1523 static const char __pyx_k_main[] = "__main__";
1524 static const char __pyx_k_one8[] = "one8";
1525 static const char __pyx_k_psiC[] = "psiC";
1526 static const char __pyx_k_q_dm[] = "q_dm";
1527 static const char __pyx_k_q_kr[] = "q_kr";
1528 static const char __pyx_k_q_mt[] = "q_mt";
1529 static const char __pyx_k_rho2[] = "rho2";
1530 static const char __pyx_k_rhom[] = "rhom";
1531 static const char __pyx_k_sBar[] = "sBar";
1532 static const char __pyx_k_test[] = "__test__";
1533 static const char __pyx_k_u_eN[] = "u_eN";
1534 static const char __pyx_k_vBar[] = "vBar";
1535 static const char __pyx_k_a_avg[] = "a_avg";
1536 static const char __pyx_k_alpha[] = "alpha";
1537 static const char __pyx_k_clock[] = "clock";
1538 static const char __pyx_k_denom[] = "denom";
1539 static const char __pyx_k_drhom[] = "drhom";
1540 static const char __pyx_k_kr_eN[] = "kr_eN";
1541 static const char __pyx_k_matID[] = "matID";
1542 static const char __pyx_k_numer[] = "numer";
1543 static const char __pyx_k_numpy[] = "numpy";
1544 static const char __pyx_k_pcBar[] = "pcBar";
1545 static const char __pyx_k_q_dkr[] = "q_dkr";
1546 static const char __pyx_k_q_dmt[] = "q_dmt";
1547 static const char __pyx_k_range[] = "range";
1548 static const char __pyx_k_shape[] = "shape";
1549 static const char __pyx_k_u_dof[] = "u_dof";
1550 static const char __pyx_k_u_l2g[] = "u_l2g";
1551 static const char __pyx_k_vBar2[] = "vBar2";
1552 static const char __pyx_k_vol_e[] = "vol_e";
1553 static const char __pyx_k_zeros[] = "zeros";
1554 static const char __pyx_k_a_neig[] = "a_neig";
1555 static const char __pyx_k_colind[] = "colind";
1556 static const char __pyx_k_dkr_up[] = "dkr_up";
1557 static const char __pyx_k_import[] = "__import__";
1558 static const char __pyx_k_mt_avg[] = "mt_avg";
1559 static const char __pyx_k_nSpace[] = "nSpace";
1560 static const char __pyx_k_phi_eN[] = "phi_eN";
1561 static const char __pyx_k_picard[] = "picard";
1562 static const char __pyx_k_q_alin[] = "q_alin";
1563 static const char __pyx_k_q_detJ[] = "q_detJ";
1564 static const char __pyx_k_q_flin[] = "q_flin";
1565 static const char __pyx_k_q_mass[] = "q_mass";
1566 static const char __pyx_k_q_vals[] = "q_vals";
1567 static const char __pyx_k_rowptr[] = "rowptr";
1568 static const char __pyx_k_thetaR[] = "thetaR";
1569 static const char __pyx_k_thetaS[] = "thetaS";
1570 static const char __pyx_k_thetaW[] = "thetaW";
1571 static const char __pyx_k_u_neig[] = "u_neig";
1572 static const char __pyx_k_volume[] = "volume";
1573 static const char __pyx_k_weight[] = "weight";
1574 static const char __pyx_k_df_dofs[] = "df_dofs";
1575 static const char __pyx_k_eN_left[] = "eN_left";
1576 static const char __pyx_k_gravity[] = "gravity";
1577 static const char __pyx_k_kr_neig[] = "kr_neig";
1578 static const char __pyx_k_nSpace2[] = "nSpace2";
1579 static const char __pyx_k_omega_e[] = "omega_e";
1580 static const char __pyx_k_pcBar_n[] = "pcBar_n";
1581 static const char __pyx_k_q_dmass[] = "q_dmass";
1582 static const char __pyx_k_q_kr_up[] = "q_kr_up";
1583 static const char __pyx_k_thetaSR[] = "thetaSR";
1584 static const char __pyx_k_dmtj_avg[] = "dmtj_avg";
1585 static const char __pyx_k_eN_right[] = "eN_right";
1586 static const char __pyx_k_ebq_vals[] = "ebq_vals";
1587 static const char __pyx_k_integral[] = "integral";
1588 static const char __pyx_k_material[] = "material";
1589 static const char __pyx_k_phi_neig[] = "phi_neig";
1590 static const char __pyx_k_q_grad_u[] = "q_grad_u";
1591 static const char __pyx_k_q_grad_v[] = "q_grad_v";
1592 static const char __pyx_k_q_grad_w[] = "q_grad_w";
1593 static const char __pyx_k_ebN_local[] = "ebN_local";
1594 static const char __pyx_k_pcBar_nM1[] = "pcBar_nM1";
1595 static const char __pyx_k_pcBar_nM2[] = "pcBar_nM2";
1596 static const char __pyx_k_sqrt_sBar[] = "sqrt_sBar";
1597 static const char __pyx_k_transient[] = "transient";
1598 static const char __pyx_k_volFactor[] = "volFactor";
1599 static const char __pyx_k_zVelocity[] = "zVelocity";
1600 static const char __pyx_k_zvelocity[] = "zvelocity";
1601 static const char __pyx_k_DKWr_DpsiC[] = "DKWr_DpsiC";
1602 static const char __pyx_k_ValueError[] = "ValueError";
1603 static const char __pyx_k_matID_neig[] = "matID_neig";
1604 static const char __pyx_k_nAvgWeight[] = "nAvgWeight";
1605 static const char __pyx_k_upwindFlag[] = "upwindFlag";
1606 static const char __pyx_k_DsBar_DpsiC[] = "DsBar_DpsiC";
1607 static const char __pyx_k_DvBar_DpsiC[] = "DvBar_DpsiC";
1608 static const char __pyx_k_ImportError[] = "ImportError";
1609 static const char __pyx_k_eN_neighbor[] = "eN_neighbor";
1610 static const char __pyx_k_RuntimeError[] = "RuntimeError";
1611 static const char __pyx_k_tForReversal[] = "tForReversal";
1612 static const char __pyx_k_DthetaW_DpsiC[] = "DthetaW_DpsiC";
1613 static const char __pyx_k_material_left[] = "material_left";
1614 static const char __pyx_k_weak_residual[] = "weak_residual";
1615 static const char __pyx_k_material_right[] = "material_right";
1616 static const char __pyx_k_ebq_global_vals[] = "ebq_global_vals";
1617 static const char __pyx_k_elementJacobian[] = "elementJacobian";
1618 static const char __pyx_k_elementResidual[] = "elementResidual";
1619 static const char __pyx_k_onePlus_pcBar_n[] = "onePlus_pcBar_n";
1620 static const char __pyx_k_nElements_global[] = "nElements_global";
1621 static const char __pyx_k_nDOF_test_element[] = "nDOF_test_element";
1622 static const char __pyx_k_material_functions[] = "material_functions";
1623 static const char __pyx_k_nDOF_trial_element[] = "nDOF_trial_element";
1624 static const char __pyx_k_updateMass_weakAvg[] = "updateMass_weakAvg";
1625 static const char __pyx_k_calculateNormalFlux[] = "calculateNormalFlux";
1626 static const char __pyx_k_thisElementIsUpwind[] = "thisElementIsUpwind";
1627 static const char __pyx_k_elementBoundaryTypes[] = "elementBoundaryTypes";
1628 static const char __pyx_k_elementMaterialTypes[] = "elementMaterialTypes";
1629 static const char __pyx_k_elementNeighborsArray[] = "elementNeighborsArray";
1630 static const char __pyx_k_elementBoundariesArray[] = "elementBoundariesArray";
1631 static const char __pyx_k_jacobian_weak_residual[] = "jacobian_weak_residual";
1632 static const char __pyx_k_characteristic_velocity[] = "characteristic_velocity";
1633 static const char __pyx_k_elementBarycentersArray[] = "elementBarycentersArray";
1634 static const char __pyx_k_nElementBoundaries_global[] = "nElementBoundaries_global";
1635 static const char __pyx_k_setElementBoundariesArray[] = "setElementBoundariesArray";
1636 static const char __pyx_k_RE_NCP1_getElementJacobian[] = "RE_NCP1_getElementJacobian";
1637 static const char __pyx_k_RE_NCP1_getElementResidual[] = "RE_NCP1_getElementResidual";
1638 static const char __pyx_k_nElementBoundaries_element[] = "nElementBoundaries_element";
1639 static const char __pyx_k_updateMassJacobian_weakAvg[] = "updateMassJacobian_weakAvg";
1640 static const char __pyx_k_vortexElementVelocityEval3[] = "vortexElementVelocityEval3";
1641 static const char __pyx_k_vortexElementVelocityEval4[] = "vortexElementVelocityEval4";
1642 static const char __pyx_k_helicalElementVelocityEval3[] = "helicalElementVelocityEval3";
1643 static const char __pyx_k_helicalElementVelocityEval4[] = "helicalElementVelocityEval4";
1644 static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
1645 static const char __pyx_k_characteristic_velocity_dofs[] = "characteristic_velocity_dofs";
1646 static const char __pyx_k_elementBoundaryElementsArray[] = "elementBoundaryElementsArray";
1647 static const char __pyx_k_elementBoundaryMaterialTypes[] = "elementBoundaryMaterialTypes";
1648 static const char __pyx_k_subsurfaceTransportFunctions[] = "subsurfaceTransportFunctions";
1649 static const char __pyx_k_exteriorElementBoundariesArray[] = "exteriorElementBoundariesArray";
1650 static const char __pyx_k_home_cekees_proteus_proteus_sub[] = "/home/cekees/proteus/proteus/subsurfaceTransportFunctions.pyx";
1651 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
1652 static const char __pyx_k_setExteriorElementBoundaryTypes[] = "setExteriorElementBoundaryTypes";
1653 static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
1654 static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
1655 static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
1656 static const char __pyx_k_RE_NCP1_evaluateElementCoefficie[] = "RE_NCP1_evaluateElementCoefficients_Linear";
1657 static const char __pyx_k_computeSimpleCharacteristicVeloc[] = "computeSimpleCharacteristicVelocityFromElementVelocity";
1658 static const char __pyx_k_evaluateScalarMaterialFunctionOv[] = "evaluateScalarMaterialFunctionOverElements";
1659 static const char __pyx_k_evaluateSparseTensorMaterialFunc[] = "evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage";
1660 static const char __pyx_k_evaluateVectorMaterialFunctionOv[] = "evaluateVectorMaterialFunctionOverElements";
1661 static const char __pyx_k_exteriorElementBoundaryMaterialT[] = "exteriorElementBoundaryMaterialTypes";
1662 static const char __pyx_k_nExteriorElementBoundaries_globa[] = "nExteriorElementBoundaries_global";
1663 static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
1664 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
1665 static const char __pyx_k_rotatingGaussianElementVelocityE[] = "rotatingGaussianElementVelocityEval3";
1666 static const char __pyx_k_setScalarMaterialFunctionOverEle[] = "setScalarMaterialFunctionOverElements";
1667 static const char __pyx_k_setScalarMaterialFunctionOverGlo[] = "setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage";
1668 static const char __pyx_k_setSparseTensorMaterialFunctionO[] = "setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage";
1669 static const char __pyx_k_setVectorMaterialFunctionOverEle[] = "setVectorMaterialFunctionOverElements";
1670 static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
1671 static const char __pyx_k_RE_NCP1_evaluateElementCoefficie_2[] = "RE_NCP1_evaluateElementCoefficients_VGM";
1672 static const char __pyx_k_computeSimpleCharacteristicVeloc_2[] = "computeSimpleCharacteristicVelocityFromVelocityDOFs";
1673 static const char __pyx_k_evaluateScalarMaterialFunctionOv_2[] = "evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage";
1674 static const char __pyx_k_evaluateScalarMaterialFunctionOv_3[] = "evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage";
1675 static const char __pyx_k_evaluateSparseTensorMaterialFunc_2[] = "evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage";
1676 static const char __pyx_k_rotatingGaussianElementVelocityE_2[] = "rotatingGaussianElementVelocityEval4";
1677 static const char __pyx_k_setScalarMaterialFunctionOverEle_2[] = "setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage";
1678 static const char __pyx_k_setSparseTensorMaterialFunctionO_2[] = "setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage";
1679 static PyObject *__pyx_n_s_DKWr_DpsiC;
1680 static PyObject *__pyx_n_s_DsBar_DpsiC;
1681 static PyObject *__pyx_n_s_DthetaW_DpsiC;
1682 static PyObject *__pyx_n_s_DvBar_DpsiC;
1683 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
1684 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
1685 static PyObject *__pyx_n_s_I;
1686 static PyObject *__pyx_n_s_ImportError;
1687 static PyObject *__pyx_n_s_J;
1688 static PyObject *__pyx_n_s_KWr;
1689 static PyObject *__pyx_n_s_KWs;
1690 static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
1691 static PyObject *__pyx_n_s_RE_NCP1_evaluateElementCoefficie;
1692 static PyObject *__pyx_n_s_RE_NCP1_evaluateElementCoefficie_2;
1693 static PyObject *__pyx_n_s_RE_NCP1_getElementJacobian;
1694 static PyObject *__pyx_n_s_RE_NCP1_getElementResidual;
1695 static PyObject *__pyx_n_s_RuntimeError;
1696 static PyObject *__pyx_n_s_ValueError;
1697 static PyObject *__pyx_n_s_a_avg;
1698 static PyObject *__pyx_n_s_a_eN;
1699 static PyObject *__pyx_n_s_a_neig;
1700 static PyObject *__pyx_n_s_a_up;
1701 static PyObject *__pyx_n_s_alpha;
1702 static PyObject *__pyx_n_s_beta;
1703 static PyObject *__pyx_n_s_calculateNormalFlux;
1704 static PyObject *__pyx_n_s_characteristic_velocity;
1705 static PyObject *__pyx_n_s_characteristic_velocity_dofs;
1706 static PyObject *__pyx_n_s_clock;
1707 static PyObject *__pyx_n_s_colind;
1708 static PyObject *__pyx_n_s_computeSimpleCharacteristicVeloc;
1709 static PyObject *__pyx_n_s_computeSimpleCharacteristicVeloc_2;
1710 static PyObject *__pyx_n_s_d;
1711 static PyObject *__pyx_n_s_dS;
1712 static PyObject *__pyx_n_s_dV;
1713 static PyObject *__pyx_n_s_denom;
1714 static PyObject *__pyx_n_s_df;
1715 static PyObject *__pyx_n_s_df_dofs;
1716 static PyObject *__pyx_n_s_dkr_up;
1717 static PyObject *__pyx_n_s_dm;
1718 static PyObject *__pyx_n_s_dmt;
1719 static PyObject *__pyx_n_s_dmtj_avg;
1720 static PyObject *__pyx_n_s_dot;
1721 static PyObject *__pyx_n_s_drhom;
1722 static PyObject *__pyx_n_s_eN;
1723 static PyObject *__pyx_n_s_eN_left;
1724 static PyObject *__pyx_n_s_eN_neighbor;
1725 static PyObject *__pyx_n_s_eN_right;
1726 static PyObject *__pyx_n_s_ebN;
1727 static PyObject *__pyx_n_s_ebNE;
1728 static PyObject *__pyx_n_s_ebN_local;
1729 static PyObject *__pyx_n_s_ebq_global_vals;
1730 static PyObject *__pyx_n_s_ebq_vals;
1731 static PyObject *__pyx_n_s_elementBarycentersArray;
1732 static PyObject *__pyx_n_s_elementBoundariesArray;
1733 static PyObject *__pyx_n_s_elementBoundaryElementsArray;
1734 static PyObject *__pyx_n_s_elementBoundaryMaterialTypes;
1735 static PyObject *__pyx_n_s_elementBoundaryTypes;
1736 static PyObject *__pyx_n_s_elementJacobian;
1737 static PyObject *__pyx_n_s_elementMaterialTypes;
1738 static PyObject *__pyx_n_s_elementNeighborsArray;
1739 static PyObject *__pyx_n_s_elementResidual;
1740 static PyObject *__pyx_n_s_evaluateScalarMaterialFunctionOv;
1741 static PyObject *__pyx_n_s_evaluateScalarMaterialFunctionOv_2;
1742 static PyObject *__pyx_n_s_evaluateScalarMaterialFunctionOv_3;
1743 static PyObject *__pyx_n_s_evaluateSparseTensorMaterialFunc;
1744 static PyObject *__pyx_n_s_evaluateSparseTensorMaterialFunc_2;
1745 static PyObject *__pyx_n_s_evaluateVectorMaterialFunctionOv;
1746 static PyObject *__pyx_n_s_exteriorElementBoundariesArray;
1747 static PyObject *__pyx_n_s_exteriorElementBoundaryMaterialT;
1748 static PyObject *__pyx_n_s_f_up;
1749 static PyObject *__pyx_n_s_flat;
1750 static PyObject *__pyx_n_s_flux;
1751 static PyObject *__pyx_n_s_gravity;
1752 static PyObject *__pyx_n_s_helicalElementVelocityEval3;
1753 static PyObject *__pyx_n_s_helicalElementVelocityEval4;
1754 static PyObject *__pyx_kp_s_home_cekees_proteus_proteus_sub;
1755 static PyObject *__pyx_n_s_i;
1756 static PyObject *__pyx_n_s_ii;
1757 static PyObject *__pyx_n_s_import;
1758 static PyObject *__pyx_n_s_integral;
1759 static PyObject *__pyx_n_s_j;
1760 static PyObject *__pyx_n_s_jacobian_weak_residual;
1761 static PyObject *__pyx_n_s_k;
1762 static PyObject *__pyx_n_s_kb;
1763 static PyObject *__pyx_n_s_kr_eN;
1764 static PyObject *__pyx_n_s_kr_neig;
1765 static PyObject *__pyx_n_s_l2g;
1766 static PyObject *__pyx_n_s_m;
1767 static PyObject *__pyx_n_s_main;
1768 static PyObject *__pyx_n_s_matID;
1769 static PyObject *__pyx_n_s_matID_neig;
1770 static PyObject *__pyx_n_s_material;
1771 static PyObject *__pyx_n_s_material_functions;
1772 static PyObject *__pyx_n_s_material_left;
1773 static PyObject *__pyx_n_s_material_right;
1774 static PyObject *__pyx_n_s_mt;
1775 static PyObject *__pyx_n_s_mt_avg;
1776 static PyObject *__pyx_n_s_n;
1777 static PyObject *__pyx_n_s_nAvgWeight;
1778 static PyObject *__pyx_n_s_nDOF_test_element;
1779 static PyObject *__pyx_n_s_nDOF_trial_element;
1780 static PyObject *__pyx_n_s_nElementBoundaries_element;
1781 static PyObject *__pyx_n_s_nElementBoundaries_global;
1782 static PyObject *__pyx_n_s_nElements_global;
1783 static PyObject *__pyx_n_s_nExteriorElementBoundaries_globa;
1784 static PyObject *__pyx_n_s_nSpace;
1785 static PyObject *__pyx_n_s_nSpace2;
1786 static PyObject *__pyx_n_s_nd;
1787 static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
1788 static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
1789 static PyObject *__pyx_n_s_nnz;
1790 static PyObject *__pyx_n_s_numer;
1791 static PyObject *__pyx_n_s_numpy;
1792 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
1793 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
1794 static PyObject *__pyx_n_s_omega_e;
1795 static PyObject *__pyx_n_s_one8;
1796 static PyObject *__pyx_n_s_onePlus_pcBar_n;
1797 static PyObject *__pyx_n_s_pcBar;
1798 static PyObject *__pyx_n_s_pcBar_n;
1799 static PyObject *__pyx_n_s_pcBar_nM1;
1800 static PyObject *__pyx_n_s_pcBar_nM2;
1801 static PyObject *__pyx_n_s_phi_eN;
1802 static PyObject *__pyx_n_s_phi_neig;
1803 static PyObject *__pyx_n_s_pi;
1804 static PyObject *__pyx_n_s_picard;
1805 static PyObject *__pyx_n_s_psiC;
1806 static PyObject *__pyx_n_s_q;
1807 static PyObject *__pyx_n_s_q_alin;
1808 static PyObject *__pyx_n_s_q_detJ;
1809 static PyObject *__pyx_n_s_q_dkr;
1810 static PyObject *__pyx_n_s_q_dm;
1811 static PyObject *__pyx_n_s_q_dmass;
1812 static PyObject *__pyx_n_s_q_dmt;
1813 static PyObject *__pyx_n_s_q_flin;
1814 static PyObject *__pyx_n_s_q_grad_u;
1815 static PyObject *__pyx_n_s_q_grad_v;
1816 static PyObject *__pyx_n_s_q_grad_w;
1817 static PyObject *__pyx_n_s_q_kr;
1818 static PyObject *__pyx_n_s_q_kr_up;
1819 static PyObject *__pyx_n_s_q_m;
1820 static PyObject *__pyx_n_s_q_mass;
1821 static PyObject *__pyx_n_s_q_mt;
1822 static PyObject *__pyx_n_s_q_r;
1823 static PyObject *__pyx_n_s_q_u;
1824 static PyObject *__pyx_n_s_q_vals;
1825 static PyObject *__pyx_n_s_q_x;
1826 static PyObject *__pyx_n_s_range;
1827 static PyObject *__pyx_n_s_rho;
1828 static PyObject *__pyx_n_s_rho2;
1829 static PyObject *__pyx_n_s_rhom;
1830 static PyObject *__pyx_n_s_rotatingGaussianElementVelocityE;
1831 static PyObject *__pyx_n_s_rotatingGaussianElementVelocityE_2;
1832 static PyObject *__pyx_n_s_rowptr;
1833 static PyObject *__pyx_n_s_sBar;
1834 static PyObject *__pyx_n_s_setElementBoundariesArray;
1835 static PyObject *__pyx_n_s_setExteriorElementBoundaryTypes;
1836 static PyObject *__pyx_n_s_setScalarMaterialFunctionOverEle;
1837 static PyObject *__pyx_n_s_setScalarMaterialFunctionOverEle_2;
1838 static PyObject *__pyx_n_s_setScalarMaterialFunctionOverGlo;
1839 static PyObject *__pyx_n_s_setSparseTensorMaterialFunctionO;
1840 static PyObject *__pyx_n_s_setSparseTensorMaterialFunctionO_2;
1841 static PyObject *__pyx_n_s_setVectorMaterialFunctionOverEle;
1842 static PyObject *__pyx_n_s_shape;
1843 static PyObject *__pyx_n_s_sqrt_sBar;
1844 static PyObject *__pyx_n_s_subsurfaceTransportFunctions;
1845 static PyObject *__pyx_n_s_sum;
1846 static PyObject *__pyx_n_s_t;
1847 static PyObject *__pyx_n_s_tForReversal;
1848 static PyObject *__pyx_n_s_test;
1849 static PyObject *__pyx_n_s_thetaR;
1850 static PyObject *__pyx_n_s_thetaS;
1851 static PyObject *__pyx_n_s_thetaSR;
1852 static PyObject *__pyx_n_s_thetaW;
1853 static PyObject *__pyx_n_s_thisElementIsUpwind;
1854 static PyObject *__pyx_n_s_transient;
1855 static PyObject *__pyx_n_s_u_dof;
1856 static PyObject *__pyx_n_s_u_eN;
1857 static PyObject *__pyx_n_s_u_j;
1858 static PyObject *__pyx_n_s_u_l2g;
1859 static PyObject *__pyx_n_s_u_neig;
1860 static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
1861 static PyObject *__pyx_n_s_updateMassJacobian_weakAvg;
1862 static PyObject *__pyx_n_s_updateMass_weakAvg;
1863 static PyObject *__pyx_n_s_upwindFlag;
1864 static PyObject *__pyx_n_s_v;
1865 static PyObject *__pyx_n_s_vBar;
1866 static PyObject *__pyx_n_s_vBar2;
1867 static PyObject *__pyx_n_s_vol;
1868 static PyObject *__pyx_n_s_volFactor;
1869 static PyObject *__pyx_n_s_vol_e;
1870 static PyObject *__pyx_n_s_volume;
1871 static PyObject *__pyx_n_s_vortexElementVelocityEval3;
1872 static PyObject *__pyx_n_s_vortexElementVelocityEval4;
1873 static PyObject *__pyx_n_s_w;
1874 static PyObject *__pyx_n_s_weak_residual;
1875 static PyObject *__pyx_n_s_weight;
1876 static PyObject *__pyx_n_s_x;
1877 static PyObject *__pyx_n_s_xc;
1878 static PyObject *__pyx_n_s_yc;
1879 static PyObject *__pyx_n_s_zVelocity;
1880 static PyObject *__pyx_n_s_zeros;
1881 static PyObject *__pyx_n_s_zvelocity;
1882 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_setExteriorElementBoundaryTypes(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nExteriorElementBoundaries_global, PyArrayObject *__pyx_v_exteriorElementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_exteriorElementBoundaryMaterialTypes); /* proto */
1883 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_2setElementBoundariesArray(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nElementBoundaries_global, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_elementBoundaryMaterialTypes); /* proto */
1884 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions); /* proto */
1885 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions); /* proto */
1886 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions); /* proto */
1887 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions); /* proto */
1888 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions); /* proto */
1889 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions); /* proto */
1890 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions); /* proto */
1891 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions); /* proto */
1892 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions); /* proto */
1893 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, double __pyx_v_t, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions); /* proto */
1894 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions); /* proto */
1895 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, double __pyx_v_t, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions); /* proto */
1896 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rho, PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, PyArrayObject *__pyx_v_KWs, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin); /* proto */
1897 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rho, double __pyx_v_beta, PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_alpha, PyArrayObject *__pyx_v_n, PyArrayObject *__pyx_v_thetaR, PyArrayObject *__pyx_v_thetaSR, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray, PyArrayObject *__pyx_v_elementBarycentersArray, PyArrayObject *__pyx_v_elementMaterialTypes, int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_u_l2g, PyArrayObject *__pyx_v_u_dof, CYTHON_UNUSED PyArrayObject *__pyx_v_q_x, PyArrayObject *__pyx_v_q_u, PyArrayObject *__pyx_v_q_mass, PyArrayObject *__pyx_v_q_dmass, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, PyArrayObject *__pyx_v_q_dkr, PyArrayObject *__pyx_v_q_kr_up); /* proto */
1898 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray, int __pyx_v_nDOF_test_element, PyArrayObject *__pyx_v_q_u, PyArrayObject *__pyx_v_q_grad_u, PyArrayObject *__pyx_v_q_grad_w, PyArrayObject *__pyx_v_q_detJ, PyArrayObject *__pyx_v_q_m, PyArrayObject *__pyx_v_q_mt, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, PyArrayObject *__pyx_v_q_kr_up, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin, PyArrayObject *__pyx_v_elementResidual); /* proto */
1899 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray, int __pyx_v_nDOF_test_element, int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_q_u, CYTHON_UNUSED PyArrayObject *__pyx_v_q_grad_u, PyArrayObject *__pyx_v_q_grad_w, PyArrayObject *__pyx_v_q_grad_v, PyArrayObject *__pyx_v_q_detJ, PyArrayObject *__pyx_v_q_m, CYTHON_UNUSED PyArrayObject *__pyx_v_q_dm, PyArrayObject *__pyx_v_q_mt, PyArrayObject *__pyx_v_q_dmt, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, CYTHON_UNUSED PyArrayObject *__pyx_v_q_dkr, PyArrayObject *__pyx_v_q_kr_up, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin, PyArrayObject *__pyx_v_elementJacobian); /* proto */
1900 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_36updateMass_weakAvg(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mt, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_dV, PyArrayObject *__pyx_v_weak_residual); /* proto */
1901 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_dmt, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_dV, PyArrayObject *__pyx_v_jacobian_weak_residual); /* proto */
1902 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_40calculateNormalFlux(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_n, PyArrayObject *__pyx_v_dS, PyArrayObject *__pyx_v_flux); /* proto */
1903 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_df, PyArrayObject *__pyx_v_characteristic_velocity, PyArrayObject *__pyx_v_dm, PyArrayObject *__pyx_v_dV); /* proto */
1904 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_df_dofs, PyArrayObject *__pyx_v_characteristic_velocity_dofs, PyArrayObject *__pyx_v_l2g, PyArrayObject *__pyx_v_dm, PyArrayObject *__pyx_v_dV); /* proto */
1905 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_46rotatingGaussianElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v, double __pyx_v_zvelocity); /* proto */
1906 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_48rotatingGaussianElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v, double __pyx_v_zvelocity); /* proto */
1907 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_50helicalElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_zVelocity, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v); /* proto */
1908 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_52helicalElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_zVelocity, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v); /* proto */
1909 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_54vortexElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v); /* proto */
1910 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_56vortexElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v); /* proto */
1911 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
1912 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
1913 static PyObject *__pyx_float_0_0;
1914 static PyObject *__pyx_float_0_5;
1915 static PyObject *__pyx_float_2_0;
1916 static PyObject *__pyx_float_1_0eneg_20;
1917 static PyObject *__pyx_slice_;
1918 static PyObject *__pyx_slice__2;
1919 static PyObject *__pyx_slice__3;
1920 static PyObject *__pyx_slice__4;
1921 static PyObject *__pyx_slice__5;
1922 static PyObject *__pyx_slice__6;
1923 static PyObject *__pyx_slice__7;
1924 static PyObject *__pyx_slice__8;
1925 static PyObject *__pyx_tuple__9;
1926 static PyObject *__pyx_tuple__10;
1927 static PyObject *__pyx_tuple__11;
1928 static PyObject *__pyx_tuple__12;
1929 static PyObject *__pyx_tuple__13;
1930 static PyObject *__pyx_tuple__14;
1931 static PyObject *__pyx_tuple__15;
1932 static PyObject *__pyx_tuple__16;
1933 static PyObject *__pyx_tuple__17;
1934 static PyObject *__pyx_tuple__18;
1935 static PyObject *__pyx_tuple__20;
1936 static PyObject *__pyx_tuple__22;
1937 static PyObject *__pyx_tuple__24;
1938 static PyObject *__pyx_tuple__26;
1939 static PyObject *__pyx_tuple__28;
1940 static PyObject *__pyx_tuple__30;
1941 static PyObject *__pyx_tuple__32;
1942 static PyObject *__pyx_tuple__34;
1943 static PyObject *__pyx_tuple__36;
1944 static PyObject *__pyx_tuple__38;
1945 static PyObject *__pyx_tuple__40;
1946 static PyObject *__pyx_tuple__42;
1947 static PyObject *__pyx_tuple__44;
1948 static PyObject *__pyx_tuple__46;
1949 static PyObject *__pyx_tuple__48;
1950 static PyObject *__pyx_tuple__50;
1951 static PyObject *__pyx_tuple__52;
1952 static PyObject *__pyx_tuple__54;
1953 static PyObject *__pyx_tuple__56;
1954 static PyObject *__pyx_tuple__58;
1955 static PyObject *__pyx_tuple__60;
1956 static PyObject *__pyx_tuple__62;
1957 static PyObject *__pyx_tuple__64;
1958 static PyObject *__pyx_tuple__66;
1959 static PyObject *__pyx_tuple__68;
1960 static PyObject *__pyx_tuple__70;
1961 static PyObject *__pyx_tuple__72;
1962 static PyObject *__pyx_tuple__74;
1963 static PyObject *__pyx_codeobj__19;
1964 static PyObject *__pyx_codeobj__21;
1965 static PyObject *__pyx_codeobj__23;
1966 static PyObject *__pyx_codeobj__25;
1967 static PyObject *__pyx_codeobj__27;
1968 static PyObject *__pyx_codeobj__29;
1969 static PyObject *__pyx_codeobj__31;
1970 static PyObject *__pyx_codeobj__33;
1971 static PyObject *__pyx_codeobj__35;
1972 static PyObject *__pyx_codeobj__37;
1973 static PyObject *__pyx_codeobj__39;
1974 static PyObject *__pyx_codeobj__41;
1975 static PyObject *__pyx_codeobj__43;
1976 static PyObject *__pyx_codeobj__45;
1977 static PyObject *__pyx_codeobj__47;
1978 static PyObject *__pyx_codeobj__49;
1979 static PyObject *__pyx_codeobj__51;
1980 static PyObject *__pyx_codeobj__53;
1981 static PyObject *__pyx_codeobj__55;
1982 static PyObject *__pyx_codeobj__57;
1983 static PyObject *__pyx_codeobj__59;
1984 static PyObject *__pyx_codeobj__61;
1985 static PyObject *__pyx_codeobj__63;
1986 static PyObject *__pyx_codeobj__65;
1987 static PyObject *__pyx_codeobj__67;
1988 static PyObject *__pyx_codeobj__69;
1989 static PyObject *__pyx_codeobj__71;
1990 static PyObject *__pyx_codeobj__73;
1991 static PyObject *__pyx_codeobj__75;
1992 
1993 /* "subsurfaceTransportFunctions.pyx":11
1994  * double sin(double x)
1995  * double M_PI
1996  * cdef inline double double_max(double a, double b): return a if a >= b else b # <<<<<<<<<<<<<<
1997  * cdef inline double double_min(double a, double b): return a if a <= b else b
1998  *
1999  */
2000 
2001 static CYTHON_INLINE double __pyx_f_28subsurfaceTransportFunctions_double_max(double __pyx_v_a, double __pyx_v_b) {
2002  double __pyx_r;
2003  __Pyx_RefNannyDeclarations
2004  double __pyx_t_1;
2005  __Pyx_RefNannySetupContext("double_max", 0);
2006  if (((__pyx_v_a >= __pyx_v_b) != 0)) {
2007  __pyx_t_1 = __pyx_v_a;
2008  } else {
2009  __pyx_t_1 = __pyx_v_b;
2010  }
2011  __pyx_r = __pyx_t_1;
2012  goto __pyx_L0;
2013 
2014  /* function exit code */
2015  __pyx_L0:;
2016  __Pyx_RefNannyFinishContext();
2017  return __pyx_r;
2018 }
2019 
2020 /* "subsurfaceTransportFunctions.pyx":12
2021  * double M_PI
2022  * cdef inline double double_max(double a, double b): return a if a >= b else b
2023  * cdef inline double double_min(double a, double b): return a if a <= b else b # <<<<<<<<<<<<<<
2024  *
2025  * ctypedef numpy.double_t DTYPE_t
2026  */
2027 
2028 static CYTHON_INLINE double __pyx_f_28subsurfaceTransportFunctions_double_min(double __pyx_v_a, double __pyx_v_b) {
2029  double __pyx_r;
2030  __Pyx_RefNannyDeclarations
2031  double __pyx_t_1;
2032  __Pyx_RefNannySetupContext("double_min", 0);
2033  if (((__pyx_v_a <= __pyx_v_b) != 0)) {
2034  __pyx_t_1 = __pyx_v_a;
2035  } else {
2036  __pyx_t_1 = __pyx_v_b;
2037  }
2038  __pyx_r = __pyx_t_1;
2039  goto __pyx_L0;
2040 
2041  /* function exit code */
2042  __pyx_L0:;
2043  __Pyx_RefNannyFinishContext();
2044  return __pyx_r;
2045 }
2046 
2047 /* "subsurfaceTransportFunctions.pyx":18
2048  * ctypedef int ITYPE_t
2049  *
2050  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global, # <<<<<<<<<<<<<<
2051  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundariesArray,
2052  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
2053  */
2054 
2055 /* Python wrapper */
2056 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2057 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes = {"setExteriorElementBoundaryTypes", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes, METH_VARARGS|METH_KEYWORDS, 0};
2058 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2059  int __pyx_v_nExteriorElementBoundaries_global;
2060  PyArrayObject *__pyx_v_exteriorElementBoundariesArray = 0;
2061  PyArrayObject *__pyx_v_elementBoundaryElementsArray = 0;
2062  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
2063  PyArrayObject *__pyx_v_exteriorElementBoundaryMaterialTypes = 0;
2064  PyObject *__pyx_r = 0;
2065  __Pyx_RefNannyDeclarations
2066  __Pyx_RefNannySetupContext("setExteriorElementBoundaryTypes (wrapper)", 0);
2067  {
2068  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nExteriorElementBoundaries_globa,&__pyx_n_s_exteriorElementBoundariesArray,&__pyx_n_s_elementBoundaryElementsArray,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_exteriorElementBoundaryMaterialT,0};
2069  PyObject* values[5] = {0,0,0,0,0};
2070  if (unlikely(__pyx_kwds)) {
2071  Py_ssize_t kw_args;
2072  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2073  switch (pos_args) {
2074  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2075  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2076  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2077  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2078  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2079  case 0: break;
2080  default: goto __pyx_L5_argtuple_error;
2081  }
2082  kw_args = PyDict_Size(__pyx_kwds);
2083  switch (pos_args) {
2084  case 0:
2085  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nExteriorElementBoundaries_globa)) != 0)) kw_args--;
2086  else goto __pyx_L5_argtuple_error;
2087  case 1:
2088  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_exteriorElementBoundariesArray)) != 0)) kw_args--;
2089  else {
2090  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, 1); __PYX_ERR(0, 18, __pyx_L3_error)
2091  }
2092  case 2:
2093  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundaryElementsArray)) != 0)) kw_args--;
2094  else {
2095  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, 2); __PYX_ERR(0, 18, __pyx_L3_error)
2096  }
2097  case 3:
2098  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
2099  else {
2100  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, 3); __PYX_ERR(0, 18, __pyx_L3_error)
2101  }
2102  case 4:
2103  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_exteriorElementBoundaryMaterialT)) != 0)) kw_args--;
2104  else {
2105  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, 4); __PYX_ERR(0, 18, __pyx_L3_error)
2106  }
2107  }
2108  if (unlikely(kw_args > 0)) {
2109  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setExteriorElementBoundaryTypes") < 0)) __PYX_ERR(0, 18, __pyx_L3_error)
2110  }
2111  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
2112  goto __pyx_L5_argtuple_error;
2113  } else {
2114  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2115  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2116  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2117  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2118  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2119  }
2120  __pyx_v_nExteriorElementBoundaries_global = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nExteriorElementBoundaries_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 18, __pyx_L3_error)
2121  __pyx_v_exteriorElementBoundariesArray = ((PyArrayObject *)values[1]);
2122  __pyx_v_elementBoundaryElementsArray = ((PyArrayObject *)values[2]);
2123  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[3]);
2124  __pyx_v_exteriorElementBoundaryMaterialTypes = ((PyArrayObject *)values[4]);
2125  }
2126  goto __pyx_L4_argument_unpacking_done;
2127  __pyx_L5_argtuple_error:;
2128  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 18, __pyx_L3_error)
2129  __pyx_L3_error:;
2130  __Pyx_AddTraceback("subsurfaceTransportFunctions.setExteriorElementBoundaryTypes", __pyx_clineno, __pyx_lineno, __pyx_filename);
2131  __Pyx_RefNannyFinishContext();
2132  return NULL;
2133  __pyx_L4_argument_unpacking_done:;
2134  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_exteriorElementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "exteriorElementBoundariesArray", 0))) __PYX_ERR(0, 19, __pyx_L1_error)
2135  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryElementsArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryElementsArray", 0))) __PYX_ERR(0, 20, __pyx_L1_error)
2136  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 21, __pyx_L1_error)
2137  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_exteriorElementBoundaryMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "exteriorElementBoundaryMaterialTypes", 0))) __PYX_ERR(0, 22, __pyx_L1_error)
2138  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_setExteriorElementBoundaryTypes(__pyx_self, __pyx_v_nExteriorElementBoundaries_global, __pyx_v_exteriorElementBoundariesArray, __pyx_v_elementBoundaryElementsArray, __pyx_v_elementMaterialTypes, __pyx_v_exteriorElementBoundaryMaterialTypes);
2139 
2140  /* function exit code */
2141  goto __pyx_L0;
2142  __pyx_L1_error:;
2143  __pyx_r = NULL;
2144  __pyx_L0:;
2145  __Pyx_RefNannyFinishContext();
2146  return __pyx_r;
2147 }
2148 
2149 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_setExteriorElementBoundaryTypes(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nExteriorElementBoundaries_global, PyArrayObject *__pyx_v_exteriorElementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_exteriorElementBoundaryMaterialTypes) {
2150  int __pyx_v_ebNE;
2151  int __pyx_v_ebN;
2152  int __pyx_v_eN;
2153  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryElementsArray;
2154  __Pyx_Buffer __pyx_pybuffer_elementBoundaryElementsArray;
2155  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
2156  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
2157  __Pyx_LocalBuf_ND __pyx_pybuffernd_exteriorElementBoundariesArray;
2158  __Pyx_Buffer __pyx_pybuffer_exteriorElementBoundariesArray;
2159  __Pyx_LocalBuf_ND __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes;
2160  __Pyx_Buffer __pyx_pybuffer_exteriorElementBoundaryMaterialTypes;
2161  PyObject *__pyx_r = NULL;
2162  __Pyx_RefNannyDeclarations
2163  int __pyx_t_1;
2164  int __pyx_t_2;
2165  Py_ssize_t __pyx_t_3;
2166  int __pyx_t_4;
2167  Py_ssize_t __pyx_t_5;
2168  Py_ssize_t __pyx_t_6;
2169  Py_ssize_t __pyx_t_7;
2170  Py_ssize_t __pyx_t_8;
2171  __Pyx_RefNannySetupContext("setExteriorElementBoundaryTypes", 0);
2172  __pyx_pybuffer_exteriorElementBoundariesArray.pybuffer.buf = NULL;
2173  __pyx_pybuffer_exteriorElementBoundariesArray.refcount = 0;
2174  __pyx_pybuffernd_exteriorElementBoundariesArray.data = NULL;
2175  __pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer = &__pyx_pybuffer_exteriorElementBoundariesArray;
2176  __pyx_pybuffer_elementBoundaryElementsArray.pybuffer.buf = NULL;
2177  __pyx_pybuffer_elementBoundaryElementsArray.refcount = 0;
2178  __pyx_pybuffernd_elementBoundaryElementsArray.data = NULL;
2179  __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer = &__pyx_pybuffer_elementBoundaryElementsArray;
2180  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
2181  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
2182  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
2183  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
2184  __pyx_pybuffer_exteriorElementBoundaryMaterialTypes.pybuffer.buf = NULL;
2185  __pyx_pybuffer_exteriorElementBoundaryMaterialTypes.refcount = 0;
2186  __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.data = NULL;
2187  __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer = &__pyx_pybuffer_exteriorElementBoundaryMaterialTypes;
2188  {
2189  __Pyx_BufFmt_StackElem __pyx_stack[1];
2190  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_exteriorElementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 18, __pyx_L1_error)
2191  }
2192  __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer.shape[0];
2193  {
2194  __Pyx_BufFmt_StackElem __pyx_stack[1];
2195  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryElementsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 18, __pyx_L1_error)
2196  }
2197  __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.shape[1];
2198  {
2199  __Pyx_BufFmt_StackElem __pyx_stack[1];
2200  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 18, __pyx_L1_error)
2201  }
2202  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
2203  {
2204  __Pyx_BufFmt_StackElem __pyx_stack[1];
2205  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_exteriorElementBoundaryMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 18, __pyx_L1_error)
2206  }
2207  __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer.shape[0];
2208 
2209  /* "subsurfaceTransportFunctions.pyx":24
2210  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundaryMaterialTypes):
2211  * cdef int ebNE,ebN,eN
2212  * for ebNE in range(nExteriorElementBoundaries_global): # <<<<<<<<<<<<<<
2213  * ebN = exteriorElementBoundariesArray[ebNE]
2214  * eN = elementBoundaryElementsArray[ebN,0]
2215  */
2216  __pyx_t_1 = __pyx_v_nExteriorElementBoundaries_global;
2217  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
2218  __pyx_v_ebNE = __pyx_t_2;
2219 
2220  /* "subsurfaceTransportFunctions.pyx":25
2221  * cdef int ebNE,ebN,eN
2222  * for ebNE in range(nExteriorElementBoundaries_global):
2223  * ebN = exteriorElementBoundariesArray[ebNE] # <<<<<<<<<<<<<<
2224  * eN = elementBoundaryElementsArray[ebN,0]
2225  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
2226  */
2227  __pyx_t_3 = __pyx_v_ebNE;
2228  __pyx_t_4 = -1;
2229  if (__pyx_t_3 < 0) {
2230  __pyx_t_3 += __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].shape;
2231  if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0;
2232  } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].shape)) __pyx_t_4 = 0;
2233  if (unlikely(__pyx_t_4 != -1)) {
2234  __Pyx_RaiseBufferIndexError(__pyx_t_4);
2235  __PYX_ERR(0, 25, __pyx_L1_error)
2236  }
2237  __pyx_v_ebN = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].strides));
2238 
2239  /* "subsurfaceTransportFunctions.pyx":26
2240  * for ebNE in range(nExteriorElementBoundaries_global):
2241  * ebN = exteriorElementBoundariesArray[ebNE]
2242  * eN = elementBoundaryElementsArray[ebN,0] # <<<<<<<<<<<<<<
2243  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
2244  *
2245  */
2246  __pyx_t_5 = __pyx_v_ebN;
2247  __pyx_t_6 = 0;
2248  __pyx_t_4 = -1;
2249  if (__pyx_t_5 < 0) {
2250  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape;
2251  if (unlikely(__pyx_t_5 < 0)) __pyx_t_4 = 0;
2252  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape)) __pyx_t_4 = 0;
2253  if (__pyx_t_6 < 0) {
2254  __pyx_t_6 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape;
2255  if (unlikely(__pyx_t_6 < 0)) __pyx_t_4 = 1;
2256  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape)) __pyx_t_4 = 1;
2257  if (unlikely(__pyx_t_4 != -1)) {
2258  __Pyx_RaiseBufferIndexError(__pyx_t_4);
2259  __PYX_ERR(0, 26, __pyx_L1_error)
2260  }
2261  __pyx_v_eN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides));
2262 
2263  /* "subsurfaceTransportFunctions.pyx":27
2264  * ebN = exteriorElementBoundariesArray[ebNE]
2265  * eN = elementBoundaryElementsArray[ebN,0]
2266  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
2267  *
2268  * def setElementBoundariesArray(int nElementBoundaries_global,
2269  */
2270  __pyx_t_7 = __pyx_v_eN;
2271  __pyx_t_4 = -1;
2272  if (__pyx_t_7 < 0) {
2273  __pyx_t_7 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2274  if (unlikely(__pyx_t_7 < 0)) __pyx_t_4 = 0;
2275  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_4 = 0;
2276  if (unlikely(__pyx_t_4 != -1)) {
2277  __Pyx_RaiseBufferIndexError(__pyx_t_4);
2278  __PYX_ERR(0, 27, __pyx_L1_error)
2279  }
2280  __pyx_t_8 = __pyx_v_ebNE;
2281  __pyx_t_4 = -1;
2282  if (__pyx_t_8 < 0) {
2283  __pyx_t_8 += __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].shape;
2284  if (unlikely(__pyx_t_8 < 0)) __pyx_t_4 = 0;
2285  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].shape)) __pyx_t_4 = 0;
2286  if (unlikely(__pyx_t_4 != -1)) {
2287  __Pyx_RaiseBufferIndexError(__pyx_t_4);
2288  __PYX_ERR(0, 27, __pyx_L1_error)
2289  }
2290  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2291  }
2292 
2293  /* "subsurfaceTransportFunctions.pyx":18
2294  * ctypedef int ITYPE_t
2295  *
2296  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global, # <<<<<<<<<<<<<<
2297  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundariesArray,
2298  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
2299  */
2300 
2301  /* function exit code */
2302  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2303  goto __pyx_L0;
2304  __pyx_L1_error:;
2305  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
2306  __Pyx_PyThreadState_declare
2307  __Pyx_PyThreadState_assign
2308  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
2309  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer);
2310  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2311  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer);
2312  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer);
2313  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
2314  __Pyx_AddTraceback("subsurfaceTransportFunctions.setExteriorElementBoundaryTypes", __pyx_clineno, __pyx_lineno, __pyx_filename);
2315  __pyx_r = NULL;
2316  goto __pyx_L2;
2317  __pyx_L0:;
2318  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer);
2319  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2320  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer);
2321  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer);
2322  __pyx_L2:;
2323  __Pyx_XGIVEREF(__pyx_r);
2324  __Pyx_RefNannyFinishContext();
2325  return __pyx_r;
2326 }
2327 
2328 /* "subsurfaceTransportFunctions.pyx":29
2329  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
2330  *
2331  * def setElementBoundariesArray(int nElementBoundaries_global, # <<<<<<<<<<<<<<
2332  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
2333  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
2334  */
2335 
2336 /* Python wrapper */
2337 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_3setElementBoundariesArray(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2338 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_3setElementBoundariesArray = {"setElementBoundariesArray", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_3setElementBoundariesArray, METH_VARARGS|METH_KEYWORDS, 0};
2339 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_3setElementBoundariesArray(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2340  int __pyx_v_nElementBoundaries_global;
2341  PyArrayObject *__pyx_v_elementBoundaryElementsArray = 0;
2342  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
2343  PyArrayObject *__pyx_v_elementBoundaryMaterialTypes = 0;
2344  PyObject *__pyx_r = 0;
2345  __Pyx_RefNannyDeclarations
2346  __Pyx_RefNannySetupContext("setElementBoundariesArray (wrapper)", 0);
2347  {
2348  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nElementBoundaries_global,&__pyx_n_s_elementBoundaryElementsArray,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_elementBoundaryMaterialTypes,0};
2349  PyObject* values[4] = {0,0,0,0};
2350  if (unlikely(__pyx_kwds)) {
2351  Py_ssize_t kw_args;
2352  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2353  switch (pos_args) {
2354  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2355  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2356  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2357  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2358  case 0: break;
2359  default: goto __pyx_L5_argtuple_error;
2360  }
2361  kw_args = PyDict_Size(__pyx_kwds);
2362  switch (pos_args) {
2363  case 0:
2364  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nElementBoundaries_global)) != 0)) kw_args--;
2365  else goto __pyx_L5_argtuple_error;
2366  case 1:
2367  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundaryElementsArray)) != 0)) kw_args--;
2368  else {
2369  __Pyx_RaiseArgtupleInvalid("setElementBoundariesArray", 1, 4, 4, 1); __PYX_ERR(0, 29, __pyx_L3_error)
2370  }
2371  case 2:
2372  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
2373  else {
2374  __Pyx_RaiseArgtupleInvalid("setElementBoundariesArray", 1, 4, 4, 2); __PYX_ERR(0, 29, __pyx_L3_error)
2375  }
2376  case 3:
2377  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundaryMaterialTypes)) != 0)) kw_args--;
2378  else {
2379  __Pyx_RaiseArgtupleInvalid("setElementBoundariesArray", 1, 4, 4, 3); __PYX_ERR(0, 29, __pyx_L3_error)
2380  }
2381  }
2382  if (unlikely(kw_args > 0)) {
2383  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setElementBoundariesArray") < 0)) __PYX_ERR(0, 29, __pyx_L3_error)
2384  }
2385  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
2386  goto __pyx_L5_argtuple_error;
2387  } else {
2388  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2389  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2390  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2391  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2392  }
2393  __pyx_v_nElementBoundaries_global = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nElementBoundaries_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 29, __pyx_L3_error)
2394  __pyx_v_elementBoundaryElementsArray = ((PyArrayObject *)values[1]);
2395  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[2]);
2396  __pyx_v_elementBoundaryMaterialTypes = ((PyArrayObject *)values[3]);
2397  }
2398  goto __pyx_L4_argument_unpacking_done;
2399  __pyx_L5_argtuple_error:;
2400  __Pyx_RaiseArgtupleInvalid("setElementBoundariesArray", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 29, __pyx_L3_error)
2401  __pyx_L3_error:;
2402  __Pyx_AddTraceback("subsurfaceTransportFunctions.setElementBoundariesArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
2403  __Pyx_RefNannyFinishContext();
2404  return NULL;
2405  __pyx_L4_argument_unpacking_done:;
2406  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryElementsArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryElementsArray", 0))) __PYX_ERR(0, 30, __pyx_L1_error)
2407  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 31, __pyx_L1_error)
2408  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryMaterialTypes", 0))) __PYX_ERR(0, 32, __pyx_L1_error)
2409  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_2setElementBoundariesArray(__pyx_self, __pyx_v_nElementBoundaries_global, __pyx_v_elementBoundaryElementsArray, __pyx_v_elementMaterialTypes, __pyx_v_elementBoundaryMaterialTypes);
2410 
2411  /* function exit code */
2412  goto __pyx_L0;
2413  __pyx_L1_error:;
2414  __pyx_r = NULL;
2415  __pyx_L0:;
2416  __Pyx_RefNannyFinishContext();
2417  return __pyx_r;
2418 }
2419 
2420 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_2setElementBoundariesArray(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nElementBoundaries_global, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_elementBoundaryMaterialTypes) {
2421  int __pyx_v_ebN;
2422  int __pyx_v_eN_left;
2423  int __pyx_v_eN_right;
2424  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryElementsArray;
2425  __Pyx_Buffer __pyx_pybuffer_elementBoundaryElementsArray;
2426  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryMaterialTypes;
2427  __Pyx_Buffer __pyx_pybuffer_elementBoundaryMaterialTypes;
2428  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
2429  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
2430  PyObject *__pyx_r = NULL;
2431  __Pyx_RefNannyDeclarations
2432  int __pyx_t_1;
2433  int __pyx_t_2;
2434  Py_ssize_t __pyx_t_3;
2435  Py_ssize_t __pyx_t_4;
2436  int __pyx_t_5;
2437  Py_ssize_t __pyx_t_6;
2438  Py_ssize_t __pyx_t_7;
2439  Py_ssize_t __pyx_t_8;
2440  Py_ssize_t __pyx_t_9;
2441  Py_ssize_t __pyx_t_10;
2442  Py_ssize_t __pyx_t_11;
2443  Py_ssize_t __pyx_t_12;
2444  Py_ssize_t __pyx_t_13;
2445  int __pyx_t_14;
2446  Py_ssize_t __pyx_t_15;
2447  Py_ssize_t __pyx_t_16;
2448  Py_ssize_t __pyx_t_17;
2449  __Pyx_RefNannySetupContext("setElementBoundariesArray", 0);
2450  __pyx_pybuffer_elementBoundaryElementsArray.pybuffer.buf = NULL;
2451  __pyx_pybuffer_elementBoundaryElementsArray.refcount = 0;
2452  __pyx_pybuffernd_elementBoundaryElementsArray.data = NULL;
2453  __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer = &__pyx_pybuffer_elementBoundaryElementsArray;
2454  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
2455  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
2456  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
2457  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
2458  __pyx_pybuffer_elementBoundaryMaterialTypes.pybuffer.buf = NULL;
2459  __pyx_pybuffer_elementBoundaryMaterialTypes.refcount = 0;
2460  __pyx_pybuffernd_elementBoundaryMaterialTypes.data = NULL;
2461  __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryMaterialTypes;
2462  {
2463  __Pyx_BufFmt_StackElem __pyx_stack[1];
2464  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryElementsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 29, __pyx_L1_error)
2465  }
2466  __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.shape[1];
2467  {
2468  __Pyx_BufFmt_StackElem __pyx_stack[1];
2469  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 29, __pyx_L1_error)
2470  }
2471  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
2472  {
2473  __Pyx_BufFmt_StackElem __pyx_stack[1];
2474  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 29, __pyx_L1_error)
2475  }
2476  __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.shape[1];
2477 
2478  /* "subsurfaceTransportFunctions.pyx":34
2479  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryMaterialTypes):
2480  * cdef int ebN,eN_left,eN_right
2481  * for ebN in range(nElementBoundaries_global): # <<<<<<<<<<<<<<
2482  * eN_left = elementBoundaryElementsArray[ebN,0]
2483  * eN_right= elementBoundaryElementsArray[ebN,1]
2484  */
2485  __pyx_t_1 = __pyx_v_nElementBoundaries_global;
2486  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
2487  __pyx_v_ebN = __pyx_t_2;
2488 
2489  /* "subsurfaceTransportFunctions.pyx":35
2490  * cdef int ebN,eN_left,eN_right
2491  * for ebN in range(nElementBoundaries_global):
2492  * eN_left = elementBoundaryElementsArray[ebN,0] # <<<<<<<<<<<<<<
2493  * eN_right= elementBoundaryElementsArray[ebN,1]
2494  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2495  */
2496  __pyx_t_3 = __pyx_v_ebN;
2497  __pyx_t_4 = 0;
2498  __pyx_t_5 = -1;
2499  if (__pyx_t_3 < 0) {
2500  __pyx_t_3 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape;
2501  if (unlikely(__pyx_t_3 < 0)) __pyx_t_5 = 0;
2502  } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape)) __pyx_t_5 = 0;
2503  if (__pyx_t_4 < 0) {
2504  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape;
2505  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 1;
2506  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape)) __pyx_t_5 = 1;
2507  if (unlikely(__pyx_t_5 != -1)) {
2508  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2509  __PYX_ERR(0, 35, __pyx_L1_error)
2510  }
2511  __pyx_v_eN_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides, __pyx_t_4, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides));
2512 
2513  /* "subsurfaceTransportFunctions.pyx":36
2514  * for ebN in range(nElementBoundaries_global):
2515  * eN_left = elementBoundaryElementsArray[ebN,0]
2516  * eN_right= elementBoundaryElementsArray[ebN,1] # <<<<<<<<<<<<<<
2517  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2518  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2519  */
2520  __pyx_t_6 = __pyx_v_ebN;
2521  __pyx_t_7 = 1;
2522  __pyx_t_5 = -1;
2523  if (__pyx_t_6 < 0) {
2524  __pyx_t_6 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape;
2525  if (unlikely(__pyx_t_6 < 0)) __pyx_t_5 = 0;
2526  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape)) __pyx_t_5 = 0;
2527  if (__pyx_t_7 < 0) {
2528  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape;
2529  if (unlikely(__pyx_t_7 < 0)) __pyx_t_5 = 1;
2530  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape)) __pyx_t_5 = 1;
2531  if (unlikely(__pyx_t_5 != -1)) {
2532  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2533  __PYX_ERR(0, 36, __pyx_L1_error)
2534  }
2535  __pyx_v_eN_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides));
2536 
2537  /* "subsurfaceTransportFunctions.pyx":37
2538  * eN_left = elementBoundaryElementsArray[ebN,0]
2539  * eN_right= elementBoundaryElementsArray[ebN,1]
2540  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left] # <<<<<<<<<<<<<<
2541  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2542  * if eN_right >= 0:
2543  */
2544  __pyx_t_8 = __pyx_v_eN_left;
2545  __pyx_t_5 = -1;
2546  if (__pyx_t_8 < 0) {
2547  __pyx_t_8 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2548  if (unlikely(__pyx_t_8 < 0)) __pyx_t_5 = 0;
2549  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
2550  if (unlikely(__pyx_t_5 != -1)) {
2551  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2552  __PYX_ERR(0, 37, __pyx_L1_error)
2553  }
2554  __pyx_t_9 = __pyx_v_ebN;
2555  __pyx_t_10 = 0;
2556  __pyx_t_5 = -1;
2557  if (__pyx_t_9 < 0) {
2558  __pyx_t_9 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape;
2559  if (unlikely(__pyx_t_9 < 0)) __pyx_t_5 = 0;
2560  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
2561  if (__pyx_t_10 < 0) {
2562  __pyx_t_10 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape;
2563  if (unlikely(__pyx_t_10 < 0)) __pyx_t_5 = 1;
2564  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape)) __pyx_t_5 = 1;
2565  if (unlikely(__pyx_t_5 != -1)) {
2566  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2567  __PYX_ERR(0, 37, __pyx_L1_error)
2568  }
2569  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2570 
2571  /* "subsurfaceTransportFunctions.pyx":38
2572  * eN_right= elementBoundaryElementsArray[ebN,1]
2573  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2574  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left] # <<<<<<<<<<<<<<
2575  * if eN_right >= 0:
2576  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_right]
2577  */
2578  __pyx_t_11 = __pyx_v_eN_left;
2579  __pyx_t_5 = -1;
2580  if (__pyx_t_11 < 0) {
2581  __pyx_t_11 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2582  if (unlikely(__pyx_t_11 < 0)) __pyx_t_5 = 0;
2583  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
2584  if (unlikely(__pyx_t_5 != -1)) {
2585  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2586  __PYX_ERR(0, 38, __pyx_L1_error)
2587  }
2588  __pyx_t_12 = __pyx_v_ebN;
2589  __pyx_t_13 = 1;
2590  __pyx_t_5 = -1;
2591  if (__pyx_t_12 < 0) {
2592  __pyx_t_12 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape;
2593  if (unlikely(__pyx_t_12 < 0)) __pyx_t_5 = 0;
2594  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
2595  if (__pyx_t_13 < 0) {
2596  __pyx_t_13 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape;
2597  if (unlikely(__pyx_t_13 < 0)) __pyx_t_5 = 1;
2598  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape)) __pyx_t_5 = 1;
2599  if (unlikely(__pyx_t_5 != -1)) {
2600  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2601  __PYX_ERR(0, 38, __pyx_L1_error)
2602  }
2603  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2604 
2605  /* "subsurfaceTransportFunctions.pyx":39
2606  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2607  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2608  * if eN_right >= 0: # <<<<<<<<<<<<<<
2609  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_right]
2610  *
2611  */
2612  __pyx_t_14 = ((__pyx_v_eN_right >= 0) != 0);
2613  if (__pyx_t_14) {
2614 
2615  /* "subsurfaceTransportFunctions.pyx":40
2616  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2617  * if eN_right >= 0:
2618  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_right] # <<<<<<<<<<<<<<
2619  *
2620  * ###
2621  */
2622  __pyx_t_15 = __pyx_v_eN_right;
2623  __pyx_t_5 = -1;
2624  if (__pyx_t_15 < 0) {
2625  __pyx_t_15 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2626  if (unlikely(__pyx_t_15 < 0)) __pyx_t_5 = 0;
2627  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
2628  if (unlikely(__pyx_t_5 != -1)) {
2629  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2630  __PYX_ERR(0, 40, __pyx_L1_error)
2631  }
2632  __pyx_t_16 = __pyx_v_ebN;
2633  __pyx_t_17 = 1;
2634  __pyx_t_5 = -1;
2635  if (__pyx_t_16 < 0) {
2636  __pyx_t_16 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape;
2637  if (unlikely(__pyx_t_16 < 0)) __pyx_t_5 = 0;
2638  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
2639  if (__pyx_t_17 < 0) {
2640  __pyx_t_17 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape;
2641  if (unlikely(__pyx_t_17 < 0)) __pyx_t_5 = 1;
2642  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape)) __pyx_t_5 = 1;
2643  if (unlikely(__pyx_t_5 != -1)) {
2644  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2645  __PYX_ERR(0, 40, __pyx_L1_error)
2646  }
2647  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2648 
2649  /* "subsurfaceTransportFunctions.pyx":39
2650  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2651  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2652  * if eN_right >= 0: # <<<<<<<<<<<<<<
2653  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_right]
2654  *
2655  */
2656  }
2657  }
2658 
2659  /* "subsurfaceTransportFunctions.pyx":29
2660  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
2661  *
2662  * def setElementBoundariesArray(int nElementBoundaries_global, # <<<<<<<<<<<<<<
2663  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
2664  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
2665  */
2666 
2667  /* function exit code */
2668  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2669  goto __pyx_L0;
2670  __pyx_L1_error:;
2671  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
2672  __Pyx_PyThreadState_declare
2673  __Pyx_PyThreadState_assign
2674  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
2675  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer);
2676  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer);
2677  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2678  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
2679  __Pyx_AddTraceback("subsurfaceTransportFunctions.setElementBoundariesArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
2680  __pyx_r = NULL;
2681  goto __pyx_L2;
2682  __pyx_L0:;
2683  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer);
2684  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer);
2685  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2686  __pyx_L2:;
2687  __Pyx_XGIVEREF(__pyx_r);
2688  __Pyx_RefNannyFinishContext();
2689  return __pyx_r;
2690 }
2691 
2692 /* "subsurfaceTransportFunctions.pyx":43
2693  *
2694  * ###
2695  * def setScalarMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
2696  * numpy.ndarray[DTYPE_t,ndim=2] q_vals,
2697  * dict material_functions):
2698  */
2699 
2700 /* Python wrapper */
2701 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2702 static char __pyx_doc_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements[] = "\n loop over quadrature array and set is material j\n likely little improvement right now without correct typing of material_functions\n ";
2703 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements = {"setScalarMaterialFunctionOverElements", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements};
2704 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2705  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
2706  PyArrayObject *__pyx_v_q_vals = 0;
2707  PyObject *__pyx_v_material_functions = 0;
2708  PyObject *__pyx_r = 0;
2709  __Pyx_RefNannyDeclarations
2710  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverElements (wrapper)", 0);
2711  {
2712  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_q_vals,&__pyx_n_s_material_functions,0};
2713  PyObject* values[3] = {0,0,0};
2714  if (unlikely(__pyx_kwds)) {
2715  Py_ssize_t kw_args;
2716  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2717  switch (pos_args) {
2718  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2719  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2720  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2721  case 0: break;
2722  default: goto __pyx_L5_argtuple_error;
2723  }
2724  kw_args = PyDict_Size(__pyx_kwds);
2725  switch (pos_args) {
2726  case 0:
2727  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
2728  else goto __pyx_L5_argtuple_error;
2729  case 1:
2730  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_vals)) != 0)) kw_args--;
2731  else {
2732  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElements", 1, 3, 3, 1); __PYX_ERR(0, 43, __pyx_L3_error)
2733  }
2734  case 2:
2735  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
2736  else {
2737  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElements", 1, 3, 3, 2); __PYX_ERR(0, 43, __pyx_L3_error)
2738  }
2739  }
2740  if (unlikely(kw_args > 0)) {
2741  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setScalarMaterialFunctionOverElements") < 0)) __PYX_ERR(0, 43, __pyx_L3_error)
2742  }
2743  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
2744  goto __pyx_L5_argtuple_error;
2745  } else {
2746  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2747  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2748  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2749  }
2750  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[0]);
2751  __pyx_v_q_vals = ((PyArrayObject *)values[1]);
2752  __pyx_v_material_functions = ((PyObject*)values[2]);
2753  }
2754  goto __pyx_L4_argument_unpacking_done;
2755  __pyx_L5_argtuple_error:;
2756  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElements", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 43, __pyx_L3_error)
2757  __pyx_L3_error:;
2758  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
2759  __Pyx_RefNannyFinishContext();
2760  return NULL;
2761  __pyx_L4_argument_unpacking_done:;
2762  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 43, __pyx_L1_error)
2763  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_vals), __pyx_ptype_5numpy_ndarray, 1, "q_vals", 0))) __PYX_ERR(0, 44, __pyx_L1_error)
2764  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 45, __pyx_L1_error)
2765  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements(__pyx_self, __pyx_v_elementMaterialTypes, __pyx_v_q_vals, __pyx_v_material_functions);
2766 
2767  /* function exit code */
2768  goto __pyx_L0;
2769  __pyx_L1_error:;
2770  __pyx_r = NULL;
2771  __pyx_L0:;
2772  __Pyx_RefNannyFinishContext();
2773  return __pyx_r;
2774 }
2775 
2776 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions) {
2777  int __pyx_v_eN;
2778  int __pyx_v_k;
2779  int __pyx_v_material;
2780  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
2781  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
2782  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_vals;
2783  __Pyx_Buffer __pyx_pybuffer_q_vals;
2784  PyObject *__pyx_r = NULL;
2785  __Pyx_RefNannyDeclarations
2786  npy_intp __pyx_t_1;
2787  int __pyx_t_2;
2788  Py_ssize_t __pyx_t_3;
2789  int __pyx_t_4;
2790  npy_intp __pyx_t_5;
2791  PyObject *__pyx_t_6 = NULL;
2792  PyObject *__pyx_t_7 = NULL;
2793  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_8;
2794  Py_ssize_t __pyx_t_9;
2795  Py_ssize_t __pyx_t_10;
2796  int __pyx_t_11;
2797  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverElements", 0);
2798  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
2799  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
2800  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
2801  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
2802  __pyx_pybuffer_q_vals.pybuffer.buf = NULL;
2803  __pyx_pybuffer_q_vals.refcount = 0;
2804  __pyx_pybuffernd_q_vals.data = NULL;
2805  __pyx_pybuffernd_q_vals.rcbuffer = &__pyx_pybuffer_q_vals;
2806  {
2807  __Pyx_BufFmt_StackElem __pyx_stack[1];
2808  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 43, __pyx_L1_error)
2809  }
2810  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
2811  {
2812  __Pyx_BufFmt_StackElem __pyx_stack[1];
2813  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 43, __pyx_L1_error)
2814  }
2815  __pyx_pybuffernd_q_vals.diminfo[0].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_vals.diminfo[0].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_vals.diminfo[1].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_vals.diminfo[1].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[1];
2816 
2817  /* "subsurfaceTransportFunctions.pyx":51
2818  * """
2819  * cdef int eN,k,material
2820  * for eN in range(q_vals.shape[0]): # <<<<<<<<<<<<<<
2821  * material = elementMaterialTypes[eN]
2822  * for k in range(q_vals.shape[1]):
2823  */
2824  __pyx_t_1 = (__pyx_v_q_vals->dimensions[0]);
2825  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
2826  __pyx_v_eN = __pyx_t_2;
2827 
2828  /* "subsurfaceTransportFunctions.pyx":52
2829  * cdef int eN,k,material
2830  * for eN in range(q_vals.shape[0]):
2831  * material = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
2832  * for k in range(q_vals.shape[1]):
2833  * q_vals[eN,k] = material_functions[material]
2834  */
2835  __pyx_t_3 = __pyx_v_eN;
2836  __pyx_t_4 = -1;
2837  if (__pyx_t_3 < 0) {
2838  __pyx_t_3 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2839  if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0;
2840  } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_4 = 0;
2841  if (unlikely(__pyx_t_4 != -1)) {
2842  __Pyx_RaiseBufferIndexError(__pyx_t_4);
2843  __PYX_ERR(0, 52, __pyx_L1_error)
2844  }
2845  __pyx_v_material = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2846 
2847  /* "subsurfaceTransportFunctions.pyx":53
2848  * for eN in range(q_vals.shape[0]):
2849  * material = elementMaterialTypes[eN]
2850  * for k in range(q_vals.shape[1]): # <<<<<<<<<<<<<<
2851  * q_vals[eN,k] = material_functions[material]
2852  *
2853  */
2854  __pyx_t_5 = (__pyx_v_q_vals->dimensions[1]);
2855  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_5; __pyx_t_4+=1) {
2856  __pyx_v_k = __pyx_t_4;
2857 
2858  /* "subsurfaceTransportFunctions.pyx":54
2859  * material = elementMaterialTypes[eN]
2860  * for k in range(q_vals.shape[1]):
2861  * q_vals[eN,k] = material_functions[material] # <<<<<<<<<<<<<<
2862  *
2863  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
2864  */
2865  if (unlikely(__pyx_v_material_functions == Py_None)) {
2866  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
2867  __PYX_ERR(0, 54, __pyx_L1_error)
2868  }
2869  __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_material); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 54, __pyx_L1_error)
2870  __Pyx_GOTREF(__pyx_t_6);
2871  __pyx_t_7 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 54, __pyx_L1_error)
2872  __Pyx_GOTREF(__pyx_t_7);
2873  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2874  __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_8 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 54, __pyx_L1_error)
2875  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2876  __pyx_t_9 = __pyx_v_eN;
2877  __pyx_t_10 = __pyx_v_k;
2878  __pyx_t_11 = -1;
2879  if (__pyx_t_9 < 0) {
2880  __pyx_t_9 += __pyx_pybuffernd_q_vals.diminfo[0].shape;
2881  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 0;
2882  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_q_vals.diminfo[0].shape)) __pyx_t_11 = 0;
2883  if (__pyx_t_10 < 0) {
2884  __pyx_t_10 += __pyx_pybuffernd_q_vals.diminfo[1].shape;
2885  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 1;
2886  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_q_vals.diminfo[1].shape)) __pyx_t_11 = 1;
2887  if (unlikely(__pyx_t_11 != -1)) {
2888  __Pyx_RaiseBufferIndexError(__pyx_t_11);
2889  __PYX_ERR(0, 54, __pyx_L1_error)
2890  }
2891  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_q_vals.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_q_vals.diminfo[1].strides) = __pyx_t_8;
2892  }
2893  }
2894 
2895  /* "subsurfaceTransportFunctions.pyx":43
2896  *
2897  * ###
2898  * def setScalarMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
2899  * numpy.ndarray[DTYPE_t,ndim=2] q_vals,
2900  * dict material_functions):
2901  */
2902 
2903  /* function exit code */
2904  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2905  goto __pyx_L0;
2906  __pyx_L1_error:;
2907  __Pyx_XDECREF(__pyx_t_6);
2908  __Pyx_XDECREF(__pyx_t_7);
2909  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
2910  __Pyx_PyThreadState_declare
2911  __Pyx_PyThreadState_assign
2912  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
2913  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2914  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
2915  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
2916  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
2917  __pyx_r = NULL;
2918  goto __pyx_L2;
2919  __pyx_L0:;
2920  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2921  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
2922  __pyx_L2:;
2923  __Pyx_XGIVEREF(__pyx_r);
2924  __Pyx_RefNannyFinishContext();
2925  return __pyx_r;
2926 }
2927 
2928 /* "subsurfaceTransportFunctions.pyx":56
2929  * q_vals[eN,k] = material_functions[material]
2930  *
2931  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
2932  * numpy.ndarray[DTYPE_t,ndim=3] q_vals,
2933  * dict material_functions):
2934  */
2935 
2936 /* Python wrapper */
2937 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2938 static char __pyx_doc_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements[] = "\n loop over quadrature array and set \013ec f_j assuming element is material j\n ";
2939 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements = {"setVectorMaterialFunctionOverElements", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements};
2940 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2941  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
2942  PyArrayObject *__pyx_v_q_vals = 0;
2943  PyObject *__pyx_v_material_functions = 0;
2944  PyObject *__pyx_r = 0;
2945  __Pyx_RefNannyDeclarations
2946  __Pyx_RefNannySetupContext("setVectorMaterialFunctionOverElements (wrapper)", 0);
2947  {
2948  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_q_vals,&__pyx_n_s_material_functions,0};
2949  PyObject* values[3] = {0,0,0};
2950  if (unlikely(__pyx_kwds)) {
2951  Py_ssize_t kw_args;
2952  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2953  switch (pos_args) {
2954  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2955  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2956  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2957  case 0: break;
2958  default: goto __pyx_L5_argtuple_error;
2959  }
2960  kw_args = PyDict_Size(__pyx_kwds);
2961  switch (pos_args) {
2962  case 0:
2963  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
2964  else goto __pyx_L5_argtuple_error;
2965  case 1:
2966  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_vals)) != 0)) kw_args--;
2967  else {
2968  __Pyx_RaiseArgtupleInvalid("setVectorMaterialFunctionOverElements", 1, 3, 3, 1); __PYX_ERR(0, 56, __pyx_L3_error)
2969  }
2970  case 2:
2971  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
2972  else {
2973  __Pyx_RaiseArgtupleInvalid("setVectorMaterialFunctionOverElements", 1, 3, 3, 2); __PYX_ERR(0, 56, __pyx_L3_error)
2974  }
2975  }
2976  if (unlikely(kw_args > 0)) {
2977  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setVectorMaterialFunctionOverElements") < 0)) __PYX_ERR(0, 56, __pyx_L3_error)
2978  }
2979  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
2980  goto __pyx_L5_argtuple_error;
2981  } else {
2982  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2983  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2984  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2985  }
2986  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[0]);
2987  __pyx_v_q_vals = ((PyArrayObject *)values[1]);
2988  __pyx_v_material_functions = ((PyObject*)values[2]);
2989  }
2990  goto __pyx_L4_argument_unpacking_done;
2991  __pyx_L5_argtuple_error:;
2992  __Pyx_RaiseArgtupleInvalid("setVectorMaterialFunctionOverElements", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 56, __pyx_L3_error)
2993  __pyx_L3_error:;
2994  __Pyx_AddTraceback("subsurfaceTransportFunctions.setVectorMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
2995  __Pyx_RefNannyFinishContext();
2996  return NULL;
2997  __pyx_L4_argument_unpacking_done:;
2998  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 56, __pyx_L1_error)
2999  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_vals), __pyx_ptype_5numpy_ndarray, 1, "q_vals", 0))) __PYX_ERR(0, 57, __pyx_L1_error)
3000  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 58, __pyx_L1_error)
3001  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements(__pyx_self, __pyx_v_elementMaterialTypes, __pyx_v_q_vals, __pyx_v_material_functions);
3002 
3003  /* function exit code */
3004  goto __pyx_L0;
3005  __pyx_L1_error:;
3006  __pyx_r = NULL;
3007  __pyx_L0:;
3008  __Pyx_RefNannyFinishContext();
3009  return __pyx_r;
3010 }
3011 
3012 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions) {
3013  int __pyx_v_eN;
3014  int __pyx_v_k;
3015  int __pyx_v_material;
3016  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
3017  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
3018  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_vals;
3019  __Pyx_Buffer __pyx_pybuffer_q_vals;
3020  PyObject *__pyx_r = NULL;
3021  __Pyx_RefNannyDeclarations
3022  npy_intp __pyx_t_1;
3023  int __pyx_t_2;
3024  Py_ssize_t __pyx_t_3;
3025  int __pyx_t_4;
3026  npy_intp __pyx_t_5;
3027  PyObject *__pyx_t_6 = NULL;
3028  PyObject *__pyx_t_7 = NULL;
3029  PyObject *__pyx_t_8 = NULL;
3030  PyObject *__pyx_t_9 = NULL;
3031  __Pyx_RefNannySetupContext("setVectorMaterialFunctionOverElements", 0);
3032  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
3033  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
3034  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
3035  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
3036  __pyx_pybuffer_q_vals.pybuffer.buf = NULL;
3037  __pyx_pybuffer_q_vals.refcount = 0;
3038  __pyx_pybuffernd_q_vals.data = NULL;
3039  __pyx_pybuffernd_q_vals.rcbuffer = &__pyx_pybuffer_q_vals;
3040  {
3041  __Pyx_BufFmt_StackElem __pyx_stack[1];
3042  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 56, __pyx_L1_error)
3043  }
3044  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
3045  {
3046  __Pyx_BufFmt_StackElem __pyx_stack[1];
3047  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 56, __pyx_L1_error)
3048  }
3049  __pyx_pybuffernd_q_vals.diminfo[0].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_vals.diminfo[0].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_vals.diminfo[1].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_vals.diminfo[1].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_vals.diminfo[2].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_vals.diminfo[2].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[2];
3050 
3051  /* "subsurfaceTransportFunctions.pyx":63
3052  * """
3053  * cdef int eN,k,material
3054  * for eN in range(q_vals.shape[0]): # <<<<<<<<<<<<<<
3055  * material = elementMaterialTypes[eN]
3056  * for k in range(q_vals.shape[1]):
3057  */
3058  __pyx_t_1 = (__pyx_v_q_vals->dimensions[0]);
3059  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
3060  __pyx_v_eN = __pyx_t_2;
3061 
3062  /* "subsurfaceTransportFunctions.pyx":64
3063  * cdef int eN,k,material
3064  * for eN in range(q_vals.shape[0]):
3065  * material = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
3066  * for k in range(q_vals.shape[1]):
3067  * q_vals[eN,k,:] = material_functions[material].flat
3068  */
3069  __pyx_t_3 = __pyx_v_eN;
3070  __pyx_t_4 = -1;
3071  if (__pyx_t_3 < 0) {
3072  __pyx_t_3 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
3073  if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0;
3074  } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_4 = 0;
3075  if (unlikely(__pyx_t_4 != -1)) {
3076  __Pyx_RaiseBufferIndexError(__pyx_t_4);
3077  __PYX_ERR(0, 64, __pyx_L1_error)
3078  }
3079  __pyx_v_material = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
3080 
3081  /* "subsurfaceTransportFunctions.pyx":65
3082  * for eN in range(q_vals.shape[0]):
3083  * material = elementMaterialTypes[eN]
3084  * for k in range(q_vals.shape[1]): # <<<<<<<<<<<<<<
3085  * q_vals[eN,k,:] = material_functions[material].flat
3086  *
3087  */
3088  __pyx_t_5 = (__pyx_v_q_vals->dimensions[1]);
3089  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_5; __pyx_t_4+=1) {
3090  __pyx_v_k = __pyx_t_4;
3091 
3092  /* "subsurfaceTransportFunctions.pyx":66
3093  * material = elementMaterialTypes[eN]
3094  * for k in range(q_vals.shape[1]):
3095  * q_vals[eN,k,:] = material_functions[material].flat # <<<<<<<<<<<<<<
3096  *
3097  *
3098  */
3099  if (unlikely(__pyx_v_material_functions == Py_None)) {
3100  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3101  __PYX_ERR(0, 66, __pyx_L1_error)
3102  }
3103  __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_material); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 66, __pyx_L1_error)
3104  __Pyx_GOTREF(__pyx_t_6);
3105  __pyx_t_7 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 66, __pyx_L1_error)
3106  __Pyx_GOTREF(__pyx_t_7);
3107  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3108  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_flat); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 66, __pyx_L1_error)
3109  __Pyx_GOTREF(__pyx_t_6);
3110  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3111  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 66, __pyx_L1_error)
3112  __Pyx_GOTREF(__pyx_t_7);
3113  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 66, __pyx_L1_error)
3114  __Pyx_GOTREF(__pyx_t_8);
3115  __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 66, __pyx_L1_error)
3116  __Pyx_GOTREF(__pyx_t_9);
3117  __Pyx_GIVEREF(__pyx_t_7);
3118  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7);
3119  __Pyx_GIVEREF(__pyx_t_8);
3120  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8);
3121  __Pyx_INCREF(__pyx_slice_);
3122  __Pyx_GIVEREF(__pyx_slice_);
3123  PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_slice_);
3124  __pyx_t_7 = 0;
3125  __pyx_t_8 = 0;
3126  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_q_vals), __pyx_t_9, __pyx_t_6) < 0)) __PYX_ERR(0, 66, __pyx_L1_error)
3127  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3128  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3129  }
3130  }
3131 
3132  /* "subsurfaceTransportFunctions.pyx":56
3133  * q_vals[eN,k] = material_functions[material]
3134  *
3135  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
3136  * numpy.ndarray[DTYPE_t,ndim=3] q_vals,
3137  * dict material_functions):
3138  */
3139 
3140  /* function exit code */
3141  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3142  goto __pyx_L0;
3143  __pyx_L1_error:;
3144  __Pyx_XDECREF(__pyx_t_6);
3145  __Pyx_XDECREF(__pyx_t_7);
3146  __Pyx_XDECREF(__pyx_t_8);
3147  __Pyx_XDECREF(__pyx_t_9);
3148  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3149  __Pyx_PyThreadState_declare
3150  __Pyx_PyThreadState_assign
3151  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3152  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
3153  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
3154  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3155  __Pyx_AddTraceback("subsurfaceTransportFunctions.setVectorMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
3156  __pyx_r = NULL;
3157  goto __pyx_L2;
3158  __pyx_L0:;
3159  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
3160  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
3161  __pyx_L2:;
3162  __Pyx_XGIVEREF(__pyx_r);
3163  __Pyx_RefNannyFinishContext();
3164  return __pyx_r;
3165 }
3166 
3167 /* "subsurfaceTransportFunctions.pyx":69
3168  *
3169  *
3170  * def setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
3171  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
3172  * numpy.ndarray[DTYPE_t,ndim=3] ebq_vals,
3173  */
3174 
3175 /* Python wrapper */
3176 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3177 static char __pyx_doc_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage[] = "\n loop over quadrature array and set f = 0.5(f^L_j+f^R_k) assuming element on left \n is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
3178 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage = {"setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage};
3179 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3180  PyArrayObject *__pyx_v_elementBoundariesArray = 0;
3181  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
3182  PyArrayObject *__pyx_v_ebq_vals = 0;
3183  PyObject *__pyx_v_material_functions = 0;
3184  PyObject *__pyx_r = 0;
3185  __Pyx_RefNannyDeclarations
3186  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage (wrapper)", 0);
3187  {
3188  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_ebq_vals,&__pyx_n_s_material_functions,0};
3189  PyObject* values[4] = {0,0,0,0};
3190  if (unlikely(__pyx_kwds)) {
3191  Py_ssize_t kw_args;
3192  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3193  switch (pos_args) {
3194  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3195  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3196  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3197  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3198  case 0: break;
3199  default: goto __pyx_L5_argtuple_error;
3200  }
3201  kw_args = PyDict_Size(__pyx_kwds);
3202  switch (pos_args) {
3203  case 0:
3204  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
3205  else goto __pyx_L5_argtuple_error;
3206  case 1:
3207  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
3208  else {
3209  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 4, 4, 1); __PYX_ERR(0, 69, __pyx_L3_error)
3210  }
3211  case 2:
3212  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ebq_vals)) != 0)) kw_args--;
3213  else {
3214  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 4, 4, 2); __PYX_ERR(0, 69, __pyx_L3_error)
3215  }
3216  case 3:
3217  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
3218  else {
3219  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 4, 4, 3); __PYX_ERR(0, 69, __pyx_L3_error)
3220  }
3221  }
3222  if (unlikely(kw_args > 0)) {
3223  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage") < 0)) __PYX_ERR(0, 69, __pyx_L3_error)
3224  }
3225  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
3226  goto __pyx_L5_argtuple_error;
3227  } else {
3228  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3229  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3230  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3231  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3232  }
3233  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[0]);
3234  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[1]);
3235  __pyx_v_ebq_vals = ((PyArrayObject *)values[2]);
3236  __pyx_v_material_functions = ((PyObject*)values[3]);
3237  }
3238  goto __pyx_L4_argument_unpacking_done;
3239  __pyx_L5_argtuple_error:;
3240  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 69, __pyx_L3_error)
3241  __pyx_L3_error:;
3242  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
3243  __Pyx_RefNannyFinishContext();
3244  return NULL;
3245  __pyx_L4_argument_unpacking_done:;
3246  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 69, __pyx_L1_error)
3247  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 70, __pyx_L1_error)
3248  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_vals", 0))) __PYX_ERR(0, 71, __pyx_L1_error)
3249  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 72, __pyx_L1_error)
3250  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(__pyx_self, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_ebq_vals, __pyx_v_material_functions);
3251 
3252  /* function exit code */
3253  goto __pyx_L0;
3254  __pyx_L1_error:;
3255  __pyx_r = NULL;
3256  __pyx_L0:;
3257  __Pyx_RefNannyFinishContext();
3258  return __pyx_r;
3259 }
3260 
3261 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions) {
3262  int __pyx_v_eN;
3263  int __pyx_v_ebN;
3264  int __pyx_v_ebN_local;
3265  int __pyx_v_k;
3266  int __pyx_v_material_left;
3267  int __pyx_v_material_right;
3268  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_vals;
3269  __Pyx_Buffer __pyx_pybuffer_ebq_vals;
3270  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
3271  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
3272  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
3273  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
3274  PyObject *__pyx_r = NULL;
3275  __Pyx_RefNannyDeclarations
3276  npy_intp __pyx_t_1;
3277  int __pyx_t_2;
3278  npy_intp __pyx_t_3;
3279  int __pyx_t_4;
3280  Py_ssize_t __pyx_t_5;
3281  Py_ssize_t __pyx_t_6;
3282  int __pyx_t_7;
3283  Py_ssize_t __pyx_t_8;
3284  Py_ssize_t __pyx_t_9;
3285  Py_ssize_t __pyx_t_10;
3286  Py_ssize_t __pyx_t_11;
3287  npy_intp __pyx_t_12;
3288  PyObject *__pyx_t_13 = NULL;
3289  PyObject *__pyx_t_14 = NULL;
3290  PyObject *__pyx_t_15 = NULL;
3291  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_16;
3292  Py_ssize_t __pyx_t_17;
3293  Py_ssize_t __pyx_t_18;
3294  Py_ssize_t __pyx_t_19;
3295  int __pyx_t_20;
3296  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 0);
3297  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
3298  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
3299  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
3300  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
3301  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
3302  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
3303  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
3304  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
3305  __pyx_pybuffer_ebq_vals.pybuffer.buf = NULL;
3306  __pyx_pybuffer_ebq_vals.refcount = 0;
3307  __pyx_pybuffernd_ebq_vals.data = NULL;
3308  __pyx_pybuffernd_ebq_vals.rcbuffer = &__pyx_pybuffer_ebq_vals;
3309  {
3310  __Pyx_BufFmt_StackElem __pyx_stack[1];
3311  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 69, __pyx_L1_error)
3312  }
3313  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
3314  {
3315  __Pyx_BufFmt_StackElem __pyx_stack[1];
3316  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 69, __pyx_L1_error)
3317  }
3318  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
3319  {
3320  __Pyx_BufFmt_StackElem __pyx_stack[1];
3321  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 69, __pyx_L1_error)
3322  }
3323  __pyx_pybuffernd_ebq_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[2];
3324 
3325  /* "subsurfaceTransportFunctions.pyx":82
3326  * cdef int eN,ebN,ebN_local,k,material_left,material_right
3327  *
3328  * for eN in range(ebq_vals.shape[0]): # <<<<<<<<<<<<<<
3329  * for ebN_local in range(ebq_vals.shape[1]):
3330  * ebN = elementBoundariesArray[eN,ebN_local]
3331  */
3332  __pyx_t_1 = (__pyx_v_ebq_vals->dimensions[0]);
3333  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
3334  __pyx_v_eN = __pyx_t_2;
3335 
3336  /* "subsurfaceTransportFunctions.pyx":83
3337  *
3338  * for eN in range(ebq_vals.shape[0]):
3339  * for ebN_local in range(ebq_vals.shape[1]): # <<<<<<<<<<<<<<
3340  * ebN = elementBoundariesArray[eN,ebN_local]
3341  * material_left = elementBoundaryTypes[ebN,0]
3342  */
3343  __pyx_t_3 = (__pyx_v_ebq_vals->dimensions[1]);
3344  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
3345  __pyx_v_ebN_local = __pyx_t_4;
3346 
3347  /* "subsurfaceTransportFunctions.pyx":84
3348  * for eN in range(ebq_vals.shape[0]):
3349  * for ebN_local in range(ebq_vals.shape[1]):
3350  * ebN = elementBoundariesArray[eN,ebN_local] # <<<<<<<<<<<<<<
3351  * material_left = elementBoundaryTypes[ebN,0]
3352  * material_right= elementBoundaryTypes[ebN,1]
3353  */
3354  __pyx_t_5 = __pyx_v_eN;
3355  __pyx_t_6 = __pyx_v_ebN_local;
3356  __pyx_t_7 = -1;
3357  if (__pyx_t_5 < 0) {
3358  __pyx_t_5 += __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape;
3359  if (unlikely(__pyx_t_5 < 0)) __pyx_t_7 = 0;
3360  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape)) __pyx_t_7 = 0;
3361  if (__pyx_t_6 < 0) {
3362  __pyx_t_6 += __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape;
3363  if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 1;
3364  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape)) __pyx_t_7 = 1;
3365  if (unlikely(__pyx_t_7 != -1)) {
3366  __Pyx_RaiseBufferIndexError(__pyx_t_7);
3367  __PYX_ERR(0, 84, __pyx_L1_error)
3368  }
3369  __pyx_v_ebN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides));
3370 
3371  /* "subsurfaceTransportFunctions.pyx":85
3372  * for ebN_local in range(ebq_vals.shape[1]):
3373  * ebN = elementBoundariesArray[eN,ebN_local]
3374  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
3375  * material_right= elementBoundaryTypes[ebN,1]
3376  * for k in range(ebq_vals.shape[2]):
3377  */
3378  __pyx_t_8 = __pyx_v_ebN;
3379  __pyx_t_9 = 0;
3380  __pyx_t_7 = -1;
3381  if (__pyx_t_8 < 0) {
3382  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
3383  if (unlikely(__pyx_t_8 < 0)) __pyx_t_7 = 0;
3384  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_7 = 0;
3385  if (__pyx_t_9 < 0) {
3386  __pyx_t_9 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
3387  if (unlikely(__pyx_t_9 < 0)) __pyx_t_7 = 1;
3388  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_7 = 1;
3389  if (unlikely(__pyx_t_7 != -1)) {
3390  __Pyx_RaiseBufferIndexError(__pyx_t_7);
3391  __PYX_ERR(0, 85, __pyx_L1_error)
3392  }
3393  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
3394 
3395  /* "subsurfaceTransportFunctions.pyx":86
3396  * ebN = elementBoundariesArray[eN,ebN_local]
3397  * material_left = elementBoundaryTypes[ebN,0]
3398  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
3399  * for k in range(ebq_vals.shape[2]):
3400  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+
3401  */
3402  __pyx_t_10 = __pyx_v_ebN;
3403  __pyx_t_11 = 1;
3404  __pyx_t_7 = -1;
3405  if (__pyx_t_10 < 0) {
3406  __pyx_t_10 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
3407  if (unlikely(__pyx_t_10 < 0)) __pyx_t_7 = 0;
3408  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_7 = 0;
3409  if (__pyx_t_11 < 0) {
3410  __pyx_t_11 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
3411  if (unlikely(__pyx_t_11 < 0)) __pyx_t_7 = 1;
3412  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_7 = 1;
3413  if (unlikely(__pyx_t_7 != -1)) {
3414  __Pyx_RaiseBufferIndexError(__pyx_t_7);
3415  __PYX_ERR(0, 86, __pyx_L1_error)
3416  }
3417  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
3418 
3419  /* "subsurfaceTransportFunctions.pyx":87
3420  * material_left = elementBoundaryTypes[ebN,0]
3421  * material_right= elementBoundaryTypes[ebN,1]
3422  * for k in range(ebq_vals.shape[2]): # <<<<<<<<<<<<<<
3423  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+
3424  * material_functions[material_right])
3425  */
3426  __pyx_t_12 = (__pyx_v_ebq_vals->dimensions[2]);
3427  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_12; __pyx_t_7+=1) {
3428  __pyx_v_k = __pyx_t_7;
3429 
3430  /* "subsurfaceTransportFunctions.pyx":88
3431  * material_right= elementBoundaryTypes[ebN,1]
3432  * for k in range(ebq_vals.shape[2]):
3433  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+ # <<<<<<<<<<<<<<
3434  * material_functions[material_right])
3435  *
3436  */
3437  if (unlikely(__pyx_v_material_functions == Py_None)) {
3438  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3439  __PYX_ERR(0, 88, __pyx_L1_error)
3440  }
3441  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 88, __pyx_L1_error)
3442  __Pyx_GOTREF(__pyx_t_13);
3443  __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 88, __pyx_L1_error)
3444  __Pyx_GOTREF(__pyx_t_14);
3445  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
3446 
3447  /* "subsurfaceTransportFunctions.pyx":89
3448  * for k in range(ebq_vals.shape[2]):
3449  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+
3450  * material_functions[material_right]) # <<<<<<<<<<<<<<
3451  *
3452  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd,
3453  */
3454  if (unlikely(__pyx_v_material_functions == Py_None)) {
3455  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3456  __PYX_ERR(0, 89, __pyx_L1_error)
3457  }
3458  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 89, __pyx_L1_error)
3459  __Pyx_GOTREF(__pyx_t_13);
3460  __pyx_t_15 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_13); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 89, __pyx_L1_error)
3461  __Pyx_GOTREF(__pyx_t_15);
3462  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
3463 
3464  /* "subsurfaceTransportFunctions.pyx":88
3465  * material_right= elementBoundaryTypes[ebN,1]
3466  * for k in range(ebq_vals.shape[2]):
3467  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+ # <<<<<<<<<<<<<<
3468  * material_functions[material_right])
3469  *
3470  */
3471  __pyx_t_13 = PyNumber_Add(__pyx_t_14, __pyx_t_15); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 88, __pyx_L1_error)
3472  __Pyx_GOTREF(__pyx_t_13);
3473  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
3474  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
3475  __pyx_t_15 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_13); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 88, __pyx_L1_error)
3476  __Pyx_GOTREF(__pyx_t_15);
3477  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
3478  __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_15); if (unlikely((__pyx_t_16 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 88, __pyx_L1_error)
3479  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
3480  __pyx_t_17 = __pyx_v_eN;
3481  __pyx_t_18 = __pyx_v_ebN_local;
3482  __pyx_t_19 = __pyx_v_k;
3483  __pyx_t_20 = -1;
3484  if (__pyx_t_17 < 0) {
3485  __pyx_t_17 += __pyx_pybuffernd_ebq_vals.diminfo[0].shape;
3486  if (unlikely(__pyx_t_17 < 0)) __pyx_t_20 = 0;
3487  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_ebq_vals.diminfo[0].shape)) __pyx_t_20 = 0;
3488  if (__pyx_t_18 < 0) {
3489  __pyx_t_18 += __pyx_pybuffernd_ebq_vals.diminfo[1].shape;
3490  if (unlikely(__pyx_t_18 < 0)) __pyx_t_20 = 1;
3491  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_ebq_vals.diminfo[1].shape)) __pyx_t_20 = 1;
3492  if (__pyx_t_19 < 0) {
3493  __pyx_t_19 += __pyx_pybuffernd_ebq_vals.diminfo[2].shape;
3494  if (unlikely(__pyx_t_19 < 0)) __pyx_t_20 = 2;
3495  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_ebq_vals.diminfo[2].shape)) __pyx_t_20 = 2;
3496  if (unlikely(__pyx_t_20 != -1)) {
3497  __Pyx_RaiseBufferIndexError(__pyx_t_20);
3498  __PYX_ERR(0, 88, __pyx_L1_error)
3499  }
3500  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_ebq_vals.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_ebq_vals.diminfo[1].strides, __pyx_t_19, __pyx_pybuffernd_ebq_vals.diminfo[2].strides) = __pyx_t_16;
3501  }
3502  }
3503  }
3504 
3505  /* "subsurfaceTransportFunctions.pyx":69
3506  *
3507  *
3508  * def setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
3509  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
3510  * numpy.ndarray[DTYPE_t,ndim=3] ebq_vals,
3511  */
3512 
3513  /* function exit code */
3514  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3515  goto __pyx_L0;
3516  __pyx_L1_error:;
3517  __Pyx_XDECREF(__pyx_t_13);
3518  __Pyx_XDECREF(__pyx_t_14);
3519  __Pyx_XDECREF(__pyx_t_15);
3520  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3521  __Pyx_PyThreadState_declare
3522  __Pyx_PyThreadState_assign
3523  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3524  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
3525  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
3526  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
3527  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3528  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
3529  __pyx_r = NULL;
3530  goto __pyx_L2;
3531  __pyx_L0:;
3532  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
3533  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
3534  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
3535  __pyx_L2:;
3536  __Pyx_XGIVEREF(__pyx_r);
3537  __Pyx_RefNannyFinishContext();
3538  return __pyx_r;
3539 }
3540 
3541 /* "subsurfaceTransportFunctions.pyx":91
3542  * material_functions[material_right])
3543  *
3544  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
3545  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
3546  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
3547  */
3548 
3549 /* Python wrapper */
3550 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3551 static char __pyx_doc_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage[] = "\n loop over quadrature array and evaluate function \ten f_{mn} = f^L_{j,mn} f^R_{k,mn}/(f^L_{j,mn}+f^R_{k,mn})\n assuming element on left is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
3552 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage = {"setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage};
3553 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3554  int __pyx_v_nd;
3555  PyArrayObject *__pyx_v_elementBoundariesArray = 0;
3556  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
3557  PyArrayObject *__pyx_v_ebq_vals = 0;
3558  PyObject *__pyx_v_material_functions = 0;
3559  PyObject *__pyx_r = 0;
3560  __Pyx_RefNannyDeclarations
3561  __Pyx_RefNannySetupContext("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage (wrapper)", 0);
3562  {
3563  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nd,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_ebq_vals,&__pyx_n_s_material_functions,0};
3564  PyObject* values[5] = {0,0,0,0,0};
3565  if (unlikely(__pyx_kwds)) {
3566  Py_ssize_t kw_args;
3567  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3568  switch (pos_args) {
3569  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3570  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3571  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3572  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3573  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3574  case 0: break;
3575  default: goto __pyx_L5_argtuple_error;
3576  }
3577  kw_args = PyDict_Size(__pyx_kwds);
3578  switch (pos_args) {
3579  case 0:
3580  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
3581  else goto __pyx_L5_argtuple_error;
3582  case 1:
3583  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
3584  else {
3585  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, 1); __PYX_ERR(0, 91, __pyx_L3_error)
3586  }
3587  case 2:
3588  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
3589  else {
3590  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, 2); __PYX_ERR(0, 91, __pyx_L3_error)
3591  }
3592  case 3:
3593  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ebq_vals)) != 0)) kw_args--;
3594  else {
3595  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, 3); __PYX_ERR(0, 91, __pyx_L3_error)
3596  }
3597  case 4:
3598  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
3599  else {
3600  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, 4); __PYX_ERR(0, 91, __pyx_L3_error)
3601  }
3602  }
3603  if (unlikely(kw_args > 0)) {
3604  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage") < 0)) __PYX_ERR(0, 91, __pyx_L3_error)
3605  }
3606  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
3607  goto __pyx_L5_argtuple_error;
3608  } else {
3609  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3610  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3611  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3612  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3613  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3614  }
3615  __pyx_v_nd = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 91, __pyx_L3_error)
3616  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[1]);
3617  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[2]);
3618  __pyx_v_ebq_vals = ((PyArrayObject *)values[3]);
3619  __pyx_v_material_functions = ((PyObject*)values[4]);
3620  }
3621  goto __pyx_L4_argument_unpacking_done;
3622  __pyx_L5_argtuple_error:;
3623  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 91, __pyx_L3_error)
3624  __pyx_L3_error:;
3625  __Pyx_AddTraceback("subsurfaceTransportFunctions.setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
3626  __Pyx_RefNannyFinishContext();
3627  return NULL;
3628  __pyx_L4_argument_unpacking_done:;
3629  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 92, __pyx_L1_error)
3630  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 93, __pyx_L1_error)
3631  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_vals", 0))) __PYX_ERR(0, 94, __pyx_L1_error)
3632  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 95, __pyx_L1_error)
3633  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(__pyx_self, __pyx_v_nd, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_ebq_vals, __pyx_v_material_functions);
3634 
3635  /* function exit code */
3636  goto __pyx_L0;
3637  __pyx_L1_error:;
3638  __pyx_r = NULL;
3639  __pyx_L0:;
3640  __Pyx_RefNannyFinishContext();
3641  return __pyx_r;
3642 }
3643 
3644 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions) {
3645  int __pyx_v_eN;
3646  int __pyx_v_ebN;
3647  int __pyx_v_ebN_local;
3648  int __pyx_v_k;
3649  int __pyx_v_material_left;
3650  int __pyx_v_material_right;
3651  int __pyx_v_I;
3652  int __pyx_v_J;
3653  double __pyx_v_numer;
3654  double __pyx_v_denom;
3655  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_vals;
3656  __Pyx_Buffer __pyx_pybuffer_ebq_vals;
3657  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
3658  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
3659  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
3660  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
3661  PyObject *__pyx_r = NULL;
3662  __Pyx_RefNannyDeclarations
3663  npy_intp __pyx_t_1;
3664  int __pyx_t_2;
3665  npy_intp __pyx_t_3;
3666  int __pyx_t_4;
3667  Py_ssize_t __pyx_t_5;
3668  Py_ssize_t __pyx_t_6;
3669  int __pyx_t_7;
3670  Py_ssize_t __pyx_t_8;
3671  Py_ssize_t __pyx_t_9;
3672  Py_ssize_t __pyx_t_10;
3673  Py_ssize_t __pyx_t_11;
3674  npy_intp __pyx_t_12;
3675  int __pyx_t_13;
3676  int __pyx_t_14;
3677  int __pyx_t_15;
3678  int __pyx_t_16;
3679  PyObject *__pyx_t_17 = NULL;
3680  PyObject *__pyx_t_18 = NULL;
3681  PyObject *__pyx_t_19 = NULL;
3682  PyObject *__pyx_t_20 = NULL;
3683  PyObject *__pyx_t_21 = NULL;
3684  double __pyx_t_22;
3685  Py_ssize_t __pyx_t_23;
3686  Py_ssize_t __pyx_t_24;
3687  Py_ssize_t __pyx_t_25;
3688  Py_ssize_t __pyx_t_26;
3689  int __pyx_t_27;
3690  __Pyx_RefNannySetupContext("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 0);
3691  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
3692  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
3693  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
3694  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
3695  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
3696  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
3697  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
3698  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
3699  __pyx_pybuffer_ebq_vals.pybuffer.buf = NULL;
3700  __pyx_pybuffer_ebq_vals.refcount = 0;
3701  __pyx_pybuffernd_ebq_vals.data = NULL;
3702  __pyx_pybuffernd_ebq_vals.rcbuffer = &__pyx_pybuffer_ebq_vals;
3703  {
3704  __Pyx_BufFmt_StackElem __pyx_stack[1];
3705  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 91, __pyx_L1_error)
3706  }
3707  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
3708  {
3709  __Pyx_BufFmt_StackElem __pyx_stack[1];
3710  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 91, __pyx_L1_error)
3711  }
3712  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
3713  {
3714  __Pyx_BufFmt_StackElem __pyx_stack[1];
3715  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 91, __pyx_L1_error)
3716  }
3717  __pyx_pybuffernd_ebq_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_ebq_vals.diminfo[3].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_ebq_vals.diminfo[3].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[3];
3718 
3719  /* "subsurfaceTransportFunctions.pyx":106
3720  * cdef double numer,denom
3721  *
3722  * for eN in range(ebq_vals.shape[0]): # <<<<<<<<<<<<<<
3723  * for ebN_local in range(ebq_vals.shape[1]):
3724  * ebN = elementBoundariesArray[eN,ebN_local]
3725  */
3726  __pyx_t_1 = (__pyx_v_ebq_vals->dimensions[0]);
3727  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
3728  __pyx_v_eN = __pyx_t_2;
3729 
3730  /* "subsurfaceTransportFunctions.pyx":107
3731  *
3732  * for eN in range(ebq_vals.shape[0]):
3733  * for ebN_local in range(ebq_vals.shape[1]): # <<<<<<<<<<<<<<
3734  * ebN = elementBoundariesArray[eN,ebN_local]
3735  * material_left = elementBoundaryTypes[ebN,0]
3736  */
3737  __pyx_t_3 = (__pyx_v_ebq_vals->dimensions[1]);
3738  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
3739  __pyx_v_ebN_local = __pyx_t_4;
3740 
3741  /* "subsurfaceTransportFunctions.pyx":108
3742  * for eN in range(ebq_vals.shape[0]):
3743  * for ebN_local in range(ebq_vals.shape[1]):
3744  * ebN = elementBoundariesArray[eN,ebN_local] # <<<<<<<<<<<<<<
3745  * material_left = elementBoundaryTypes[ebN,0]
3746  * material_right= elementBoundaryTypes[ebN,1]
3747  */
3748  __pyx_t_5 = __pyx_v_eN;
3749  __pyx_t_6 = __pyx_v_ebN_local;
3750  __pyx_t_7 = -1;
3751  if (__pyx_t_5 < 0) {
3752  __pyx_t_5 += __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape;
3753  if (unlikely(__pyx_t_5 < 0)) __pyx_t_7 = 0;
3754  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape)) __pyx_t_7 = 0;
3755  if (__pyx_t_6 < 0) {
3756  __pyx_t_6 += __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape;
3757  if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 1;
3758  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape)) __pyx_t_7 = 1;
3759  if (unlikely(__pyx_t_7 != -1)) {
3760  __Pyx_RaiseBufferIndexError(__pyx_t_7);
3761  __PYX_ERR(0, 108, __pyx_L1_error)
3762  }
3763  __pyx_v_ebN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides));
3764 
3765  /* "subsurfaceTransportFunctions.pyx":109
3766  * for ebN_local in range(ebq_vals.shape[1]):
3767  * ebN = elementBoundariesArray[eN,ebN_local]
3768  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
3769  * material_right= elementBoundaryTypes[ebN,1]
3770  * for k in range(ebq_vals.shape[2]):
3771  */
3772  __pyx_t_8 = __pyx_v_ebN;
3773  __pyx_t_9 = 0;
3774  __pyx_t_7 = -1;
3775  if (__pyx_t_8 < 0) {
3776  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
3777  if (unlikely(__pyx_t_8 < 0)) __pyx_t_7 = 0;
3778  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_7 = 0;
3779  if (__pyx_t_9 < 0) {
3780  __pyx_t_9 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
3781  if (unlikely(__pyx_t_9 < 0)) __pyx_t_7 = 1;
3782  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_7 = 1;
3783  if (unlikely(__pyx_t_7 != -1)) {
3784  __Pyx_RaiseBufferIndexError(__pyx_t_7);
3785  __PYX_ERR(0, 109, __pyx_L1_error)
3786  }
3787  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
3788 
3789  /* "subsurfaceTransportFunctions.pyx":110
3790  * ebN = elementBoundariesArray[eN,ebN_local]
3791  * material_left = elementBoundaryTypes[ebN,0]
3792  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
3793  * for k in range(ebq_vals.shape[2]):
3794  * for I in range(nd):
3795  */
3796  __pyx_t_10 = __pyx_v_ebN;
3797  __pyx_t_11 = 1;
3798  __pyx_t_7 = -1;
3799  if (__pyx_t_10 < 0) {
3800  __pyx_t_10 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
3801  if (unlikely(__pyx_t_10 < 0)) __pyx_t_7 = 0;
3802  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_7 = 0;
3803  if (__pyx_t_11 < 0) {
3804  __pyx_t_11 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
3805  if (unlikely(__pyx_t_11 < 0)) __pyx_t_7 = 1;
3806  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_7 = 1;
3807  if (unlikely(__pyx_t_7 != -1)) {
3808  __Pyx_RaiseBufferIndexError(__pyx_t_7);
3809  __PYX_ERR(0, 110, __pyx_L1_error)
3810  }
3811  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
3812 
3813  /* "subsurfaceTransportFunctions.pyx":111
3814  * material_left = elementBoundaryTypes[ebN,0]
3815  * material_right= elementBoundaryTypes[ebN,1]
3816  * for k in range(ebq_vals.shape[2]): # <<<<<<<<<<<<<<
3817  * for I in range(nd):
3818  * for J in range(nd):
3819  */
3820  __pyx_t_12 = (__pyx_v_ebq_vals->dimensions[2]);
3821  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_12; __pyx_t_7+=1) {
3822  __pyx_v_k = __pyx_t_7;
3823 
3824  /* "subsurfaceTransportFunctions.pyx":112
3825  * material_right= elementBoundaryTypes[ebN,1]
3826  * for k in range(ebq_vals.shape[2]):
3827  * for I in range(nd): # <<<<<<<<<<<<<<
3828  * for J in range(nd):
3829  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
3830  */
3831  __pyx_t_13 = __pyx_v_nd;
3832  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
3833  __pyx_v_I = __pyx_t_14;
3834 
3835  /* "subsurfaceTransportFunctions.pyx":113
3836  * for k in range(ebq_vals.shape[2]):
3837  * for I in range(nd):
3838  * for J in range(nd): # <<<<<<<<<<<<<<
3839  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
3840  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
3841  */
3842  __pyx_t_15 = __pyx_v_nd;
3843  for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
3844  __pyx_v_J = __pyx_t_16;
3845 
3846  /* "subsurfaceTransportFunctions.pyx":114
3847  * for I in range(nd):
3848  * for J in range(nd):
3849  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J] # <<<<<<<<<<<<<<
3850  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
3851  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
3852  */
3853  if (unlikely(__pyx_v_material_functions == Py_None)) {
3854  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3855  __PYX_ERR(0, 114, __pyx_L1_error)
3856  }
3857  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 114, __pyx_L1_error)
3858  __Pyx_GOTREF(__pyx_t_17);
3859  __pyx_t_18 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_17); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 114, __pyx_L1_error)
3860  __Pyx_GOTREF(__pyx_t_18);
3861  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
3862  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 114, __pyx_L1_error)
3863  __Pyx_GOTREF(__pyx_t_17);
3864  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 114, __pyx_L1_error)
3865  __Pyx_GOTREF(__pyx_t_19);
3866  __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 114, __pyx_L1_error)
3867  __Pyx_GOTREF(__pyx_t_20);
3868  __Pyx_GIVEREF(__pyx_t_17);
3869  PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_17);
3870  __Pyx_GIVEREF(__pyx_t_19);
3871  PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_19);
3872  __pyx_t_17 = 0;
3873  __pyx_t_19 = 0;
3874  __pyx_t_19 = PyObject_GetItem(__pyx_t_18, __pyx_t_20); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 114, __pyx_L1_error)
3875  __Pyx_GOTREF(__pyx_t_19);
3876  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
3877  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
3878  __pyx_t_20 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_19); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 114, __pyx_L1_error)
3879  __Pyx_GOTREF(__pyx_t_20);
3880  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
3881  if (unlikely(__pyx_v_material_functions == Py_None)) {
3882  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3883  __PYX_ERR(0, 114, __pyx_L1_error)
3884  }
3885  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 114, __pyx_L1_error)
3886  __Pyx_GOTREF(__pyx_t_19);
3887  __pyx_t_18 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_19); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 114, __pyx_L1_error)
3888  __Pyx_GOTREF(__pyx_t_18);
3889  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
3890  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 114, __pyx_L1_error)
3891  __Pyx_GOTREF(__pyx_t_19);
3892  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 114, __pyx_L1_error)
3893  __Pyx_GOTREF(__pyx_t_17);
3894  __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 114, __pyx_L1_error)
3895  __Pyx_GOTREF(__pyx_t_21);
3896  __Pyx_GIVEREF(__pyx_t_19);
3897  PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_19);
3898  __Pyx_GIVEREF(__pyx_t_17);
3899  PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_17);
3900  __pyx_t_19 = 0;
3901  __pyx_t_17 = 0;
3902  __pyx_t_17 = PyObject_GetItem(__pyx_t_18, __pyx_t_21); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 114, __pyx_L1_error)
3903  __Pyx_GOTREF(__pyx_t_17);
3904  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
3905  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
3906  __pyx_t_21 = PyNumber_Multiply(__pyx_t_20, __pyx_t_17); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 114, __pyx_L1_error)
3907  __Pyx_GOTREF(__pyx_t_21);
3908  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
3909  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
3910  __pyx_t_22 = __pyx_PyFloat_AsDouble(__pyx_t_21); if (unlikely((__pyx_t_22 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 114, __pyx_L1_error)
3911  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
3912  __pyx_v_numer = __pyx_t_22;
3913 
3914  /* "subsurfaceTransportFunctions.pyx":115
3915  * for J in range(nd):
3916  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
3917  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20 # <<<<<<<<<<<<<<
3918  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
3919  *
3920  */
3921  if (unlikely(__pyx_v_material_functions == Py_None)) {
3922  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3923  __PYX_ERR(0, 115, __pyx_L1_error)
3924  }
3925  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 115, __pyx_L1_error)
3926  __Pyx_GOTREF(__pyx_t_21);
3927  __pyx_t_17 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_21); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 115, __pyx_L1_error)
3928  __Pyx_GOTREF(__pyx_t_17);
3929  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
3930  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 115, __pyx_L1_error)
3931  __Pyx_GOTREF(__pyx_t_21);
3932  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 115, __pyx_L1_error)
3933  __Pyx_GOTREF(__pyx_t_20);
3934  __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 115, __pyx_L1_error)
3935  __Pyx_GOTREF(__pyx_t_18);
3936  __Pyx_GIVEREF(__pyx_t_21);
3937  PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_21);
3938  __Pyx_GIVEREF(__pyx_t_20);
3939  PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_20);
3940  __pyx_t_21 = 0;
3941  __pyx_t_20 = 0;
3942  __pyx_t_20 = PyObject_GetItem(__pyx_t_17, __pyx_t_18); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 115, __pyx_L1_error)
3943  __Pyx_GOTREF(__pyx_t_20);
3944  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
3945  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
3946  if (unlikely(__pyx_v_material_functions == Py_None)) {
3947  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3948  __PYX_ERR(0, 115, __pyx_L1_error)
3949  }
3950  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 115, __pyx_L1_error)
3951  __Pyx_GOTREF(__pyx_t_18);
3952  __pyx_t_17 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_18); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 115, __pyx_L1_error)
3953  __Pyx_GOTREF(__pyx_t_17);
3954  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
3955  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 115, __pyx_L1_error)
3956  __Pyx_GOTREF(__pyx_t_18);
3957  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 115, __pyx_L1_error)
3958  __Pyx_GOTREF(__pyx_t_21);
3959  __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 115, __pyx_L1_error)
3960  __Pyx_GOTREF(__pyx_t_19);
3961  __Pyx_GIVEREF(__pyx_t_18);
3962  PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_18);
3963  __Pyx_GIVEREF(__pyx_t_21);
3964  PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_21);
3965  __pyx_t_18 = 0;
3966  __pyx_t_21 = 0;
3967  __pyx_t_21 = PyObject_GetItem(__pyx_t_17, __pyx_t_19); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 115, __pyx_L1_error)
3968  __Pyx_GOTREF(__pyx_t_21);
3969  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
3970  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
3971  __pyx_t_19 = PyNumber_Add(__pyx_t_20, __pyx_t_21); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 115, __pyx_L1_error)
3972  __Pyx_GOTREF(__pyx_t_19);
3973  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
3974  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
3975  __pyx_t_21 = __Pyx_PyFloat_AddObjC(__pyx_t_19, __pyx_float_1_0eneg_20, 1.0e-20, 0); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 115, __pyx_L1_error)
3976  __Pyx_GOTREF(__pyx_t_21);
3977  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
3978  __pyx_t_22 = __pyx_PyFloat_AsDouble(__pyx_t_21); if (unlikely((__pyx_t_22 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 115, __pyx_L1_error)
3979  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
3980  __pyx_v_denom = __pyx_t_22;
3981 
3982  /* "subsurfaceTransportFunctions.pyx":116
3983  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
3984  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
3985  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom # <<<<<<<<<<<<<<
3986  *
3987  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
3988  */
3989  if (unlikely(__pyx_v_denom == 0)) {
3990  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
3991  __PYX_ERR(0, 116, __pyx_L1_error)
3992  }
3993  __pyx_t_23 = __pyx_v_eN;
3994  __pyx_t_24 = __pyx_v_ebN_local;
3995  __pyx_t_25 = __pyx_v_k;
3996  __pyx_t_26 = ((__pyx_v_I * __pyx_v_nd) + __pyx_v_J);
3997  __pyx_t_27 = -1;
3998  if (__pyx_t_23 < 0) {
3999  __pyx_t_23 += __pyx_pybuffernd_ebq_vals.diminfo[0].shape;
4000  if (unlikely(__pyx_t_23 < 0)) __pyx_t_27 = 0;
4001  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_ebq_vals.diminfo[0].shape)) __pyx_t_27 = 0;
4002  if (__pyx_t_24 < 0) {
4003  __pyx_t_24 += __pyx_pybuffernd_ebq_vals.diminfo[1].shape;
4004  if (unlikely(__pyx_t_24 < 0)) __pyx_t_27 = 1;
4005  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_ebq_vals.diminfo[1].shape)) __pyx_t_27 = 1;
4006  if (__pyx_t_25 < 0) {
4007  __pyx_t_25 += __pyx_pybuffernd_ebq_vals.diminfo[2].shape;
4008  if (unlikely(__pyx_t_25 < 0)) __pyx_t_27 = 2;
4009  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_ebq_vals.diminfo[2].shape)) __pyx_t_27 = 2;
4010  if (__pyx_t_26 < 0) {
4011  __pyx_t_26 += __pyx_pybuffernd_ebq_vals.diminfo[3].shape;
4012  if (unlikely(__pyx_t_26 < 0)) __pyx_t_27 = 3;
4013  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_ebq_vals.diminfo[3].shape)) __pyx_t_27 = 3;
4014  if (unlikely(__pyx_t_27 != -1)) {
4015  __Pyx_RaiseBufferIndexError(__pyx_t_27);
4016  __PYX_ERR(0, 116, __pyx_L1_error)
4017  }
4018  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_ebq_vals.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_ebq_vals.diminfo[1].strides, __pyx_t_25, __pyx_pybuffernd_ebq_vals.diminfo[2].strides, __pyx_t_26, __pyx_pybuffernd_ebq_vals.diminfo[3].strides) = (__pyx_v_numer / __pyx_v_denom);
4019  }
4020  }
4021  }
4022  }
4023  }
4024 
4025  /* "subsurfaceTransportFunctions.pyx":91
4026  * material_functions[material_right])
4027  *
4028  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
4029  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
4030  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
4031  */
4032 
4033  /* function exit code */
4034  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4035  goto __pyx_L0;
4036  __pyx_L1_error:;
4037  __Pyx_XDECREF(__pyx_t_17);
4038  __Pyx_XDECREF(__pyx_t_18);
4039  __Pyx_XDECREF(__pyx_t_19);
4040  __Pyx_XDECREF(__pyx_t_20);
4041  __Pyx_XDECREF(__pyx_t_21);
4042  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
4043  __Pyx_PyThreadState_declare
4044  __Pyx_PyThreadState_assign
4045  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
4046  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
4047  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4048  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4049  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
4050  __Pyx_AddTraceback("subsurfaceTransportFunctions.setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4051  __pyx_r = NULL;
4052  goto __pyx_L2;
4053  __pyx_L0:;
4054  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
4055  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4056  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4057  __pyx_L2:;
4058  __Pyx_XGIVEREF(__pyx_r);
4059  __Pyx_RefNannyFinishContext();
4060  return __pyx_r;
4061 }
4062 
4063 /* "subsurfaceTransportFunctions.pyx":118
4064  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
4065  *
4066  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
4067  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
4068  * numpy.ndarray[DTYPE_t,ndim=2] ebq_global_vals,
4069  */
4070 
4071 /* Python wrapper */
4072 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4073 static char __pyx_doc_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage[] = "\n loop over quadrature array and evaluate function f = 0.5(f^L_j+f^R_k) assuming element on left \n is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
4074 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage = {"setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage};
4075 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4076  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray = 0;
4077  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
4078  PyArrayObject *__pyx_v_ebq_global_vals = 0;
4079  PyObject *__pyx_v_material_functions = 0;
4080  PyObject *__pyx_r = 0;
4081  __Pyx_RefNannyDeclarations
4082  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage (wrapper)", 0);
4083  {
4084  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_ebq_global_vals,&__pyx_n_s_material_functions,0};
4085  PyObject* values[4] = {0,0,0,0};
4086  if (unlikely(__pyx_kwds)) {
4087  Py_ssize_t kw_args;
4088  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4089  switch (pos_args) {
4090  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4091  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4092  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4093  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4094  case 0: break;
4095  default: goto __pyx_L5_argtuple_error;
4096  }
4097  kw_args = PyDict_Size(__pyx_kwds);
4098  switch (pos_args) {
4099  case 0:
4100  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
4101  else goto __pyx_L5_argtuple_error;
4102  case 1:
4103  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
4104  else {
4105  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 4, 4, 1); __PYX_ERR(0, 118, __pyx_L3_error)
4106  }
4107  case 2:
4108  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ebq_global_vals)) != 0)) kw_args--;
4109  else {
4110  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 4, 4, 2); __PYX_ERR(0, 118, __pyx_L3_error)
4111  }
4112  case 3:
4113  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
4114  else {
4115  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 4, 4, 3); __PYX_ERR(0, 118, __pyx_L3_error)
4116  }
4117  }
4118  if (unlikely(kw_args > 0)) {
4119  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage") < 0)) __PYX_ERR(0, 118, __pyx_L3_error)
4120  }
4121  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
4122  goto __pyx_L5_argtuple_error;
4123  } else {
4124  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4125  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4126  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4127  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4128  }
4129  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[0]);
4130  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[1]);
4131  __pyx_v_ebq_global_vals = ((PyArrayObject *)values[2]);
4132  __pyx_v_material_functions = ((PyObject*)values[3]);
4133  }
4134  goto __pyx_L4_argument_unpacking_done;
4135  __pyx_L5_argtuple_error:;
4136  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 118, __pyx_L3_error)
4137  __pyx_L3_error:;
4138  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4139  __Pyx_RefNannyFinishContext();
4140  return NULL;
4141  __pyx_L4_argument_unpacking_done:;
4142  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 118, __pyx_L1_error)
4143  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 119, __pyx_L1_error)
4144  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_global_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_global_vals", 0))) __PYX_ERR(0, 120, __pyx_L1_error)
4145  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 121, __pyx_L1_error)
4146  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(__pyx_self, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_ebq_global_vals, __pyx_v_material_functions);
4147 
4148  /* function exit code */
4149  goto __pyx_L0;
4150  __pyx_L1_error:;
4151  __pyx_r = NULL;
4152  __pyx_L0:;
4153  __Pyx_RefNannyFinishContext();
4154  return __pyx_r;
4155 }
4156 
4157 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions) {
4158  int __pyx_v_ebN;
4159  int __pyx_v_material_left;
4160  int __pyx_v_material_right;
4161  npy_intp __pyx_v_k;
4162  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_global_vals;
4163  __Pyx_Buffer __pyx_pybuffer_ebq_global_vals;
4164  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
4165  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
4166  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
4167  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
4168  PyObject *__pyx_r = NULL;
4169  __Pyx_RefNannyDeclarations
4170  npy_intp __pyx_t_1;
4171  int __pyx_t_2;
4172  Py_ssize_t __pyx_t_3;
4173  Py_ssize_t __pyx_t_4;
4174  int __pyx_t_5;
4175  Py_ssize_t __pyx_t_6;
4176  Py_ssize_t __pyx_t_7;
4177  npy_intp __pyx_t_8;
4178  npy_intp __pyx_t_9;
4179  PyObject *__pyx_t_10 = NULL;
4180  PyObject *__pyx_t_11 = NULL;
4181  PyObject *__pyx_t_12 = NULL;
4182  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_13;
4183  Py_ssize_t __pyx_t_14;
4184  Py_ssize_t __pyx_t_15;
4185  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 0);
4186  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
4187  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
4188  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
4189  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
4190  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
4191  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
4192  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
4193  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
4194  __pyx_pybuffer_ebq_global_vals.pybuffer.buf = NULL;
4195  __pyx_pybuffer_ebq_global_vals.refcount = 0;
4196  __pyx_pybuffernd_ebq_global_vals.data = NULL;
4197  __pyx_pybuffernd_ebq_global_vals.rcbuffer = &__pyx_pybuffer_ebq_global_vals;
4198  {
4199  __Pyx_BufFmt_StackElem __pyx_stack[1];
4200  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 118, __pyx_L1_error)
4201  }
4202  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
4203  {
4204  __Pyx_BufFmt_StackElem __pyx_stack[1];
4205  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 118, __pyx_L1_error)
4206  }
4207  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
4208  {
4209  __Pyx_BufFmt_StackElem __pyx_stack[1];
4210  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_global_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 118, __pyx_L1_error)
4211  }
4212  __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[1];
4213 
4214  /* "subsurfaceTransportFunctions.pyx":131
4215  * cdef int ebN,material_left,material_right
4216  *
4217  * for ebN in range(ebq_global_vals.shape[0]): # <<<<<<<<<<<<<<
4218  * material_left = elementBoundaryTypes[ebN,0]
4219  * material_right= elementBoundaryTypes[ebN,1]
4220  */
4221  __pyx_t_1 = (__pyx_v_ebq_global_vals->dimensions[0]);
4222  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
4223  __pyx_v_ebN = __pyx_t_2;
4224 
4225  /* "subsurfaceTransportFunctions.pyx":132
4226  *
4227  * for ebN in range(ebq_global_vals.shape[0]):
4228  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
4229  * material_right= elementBoundaryTypes[ebN,1]
4230  * for k in range(ebq_global_vals.shape[1]):
4231  */
4232  __pyx_t_3 = __pyx_v_ebN;
4233  __pyx_t_4 = 0;
4234  __pyx_t_5 = -1;
4235  if (__pyx_t_3 < 0) {
4236  __pyx_t_3 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4237  if (unlikely(__pyx_t_3 < 0)) __pyx_t_5 = 0;
4238  } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_5 = 0;
4239  if (__pyx_t_4 < 0) {
4240  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4241  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 1;
4242  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_5 = 1;
4243  if (unlikely(__pyx_t_5 != -1)) {
4244  __Pyx_RaiseBufferIndexError(__pyx_t_5);
4245  __PYX_ERR(0, 132, __pyx_L1_error)
4246  }
4247  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4248 
4249  /* "subsurfaceTransportFunctions.pyx":133
4250  * for ebN in range(ebq_global_vals.shape[0]):
4251  * material_left = elementBoundaryTypes[ebN,0]
4252  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
4253  * for k in range(ebq_global_vals.shape[1]):
4254  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+
4255  */
4256  __pyx_t_6 = __pyx_v_ebN;
4257  __pyx_t_7 = 1;
4258  __pyx_t_5 = -1;
4259  if (__pyx_t_6 < 0) {
4260  __pyx_t_6 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4261  if (unlikely(__pyx_t_6 < 0)) __pyx_t_5 = 0;
4262  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_5 = 0;
4263  if (__pyx_t_7 < 0) {
4264  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4265  if (unlikely(__pyx_t_7 < 0)) __pyx_t_5 = 1;
4266  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_5 = 1;
4267  if (unlikely(__pyx_t_5 != -1)) {
4268  __Pyx_RaiseBufferIndexError(__pyx_t_5);
4269  __PYX_ERR(0, 133, __pyx_L1_error)
4270  }
4271  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4272 
4273  /* "subsurfaceTransportFunctions.pyx":134
4274  * material_left = elementBoundaryTypes[ebN,0]
4275  * material_right= elementBoundaryTypes[ebN,1]
4276  * for k in range(ebq_global_vals.shape[1]): # <<<<<<<<<<<<<<
4277  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+
4278  * material_functions[material_right])
4279  */
4280  __pyx_t_8 = (__pyx_v_ebq_global_vals->dimensions[1]);
4281  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
4282  __pyx_v_k = __pyx_t_9;
4283 
4284  /* "subsurfaceTransportFunctions.pyx":135
4285  * material_right= elementBoundaryTypes[ebN,1]
4286  * for k in range(ebq_global_vals.shape[1]):
4287  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+ # <<<<<<<<<<<<<<
4288  * material_functions[material_right])
4289  *
4290  */
4291  if (unlikely(__pyx_v_material_functions == Py_None)) {
4292  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4293  __PYX_ERR(0, 135, __pyx_L1_error)
4294  }
4295  __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 135, __pyx_L1_error)
4296  __Pyx_GOTREF(__pyx_t_10);
4297  __pyx_t_11 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 135, __pyx_L1_error)
4298  __Pyx_GOTREF(__pyx_t_11);
4299  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4300 
4301  /* "subsurfaceTransportFunctions.pyx":136
4302  * for k in range(ebq_global_vals.shape[1]):
4303  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+
4304  * material_functions[material_right]) # <<<<<<<<<<<<<<
4305  *
4306  *
4307  */
4308  if (unlikely(__pyx_v_material_functions == Py_None)) {
4309  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4310  __PYX_ERR(0, 136, __pyx_L1_error)
4311  }
4312  __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 136, __pyx_L1_error)
4313  __Pyx_GOTREF(__pyx_t_10);
4314  __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_10); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 136, __pyx_L1_error)
4315  __Pyx_GOTREF(__pyx_t_12);
4316  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4317 
4318  /* "subsurfaceTransportFunctions.pyx":135
4319  * material_right= elementBoundaryTypes[ebN,1]
4320  * for k in range(ebq_global_vals.shape[1]):
4321  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+ # <<<<<<<<<<<<<<
4322  * material_functions[material_right])
4323  *
4324  */
4325  __pyx_t_10 = PyNumber_Add(__pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 135, __pyx_L1_error)
4326  __Pyx_GOTREF(__pyx_t_10);
4327  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
4328  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4329  __pyx_t_12 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_10); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 135, __pyx_L1_error)
4330  __Pyx_GOTREF(__pyx_t_12);
4331  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4332  __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_13 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 135, __pyx_L1_error)
4333  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4334  __pyx_t_14 = __pyx_v_ebN;
4335  __pyx_t_15 = __pyx_v_k;
4336  __pyx_t_5 = -1;
4337  if (__pyx_t_14 < 0) {
4338  __pyx_t_14 += __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape;
4339  if (unlikely(__pyx_t_14 < 0)) __pyx_t_5 = 0;
4340  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape)) __pyx_t_5 = 0;
4341  if (__pyx_t_15 < 0) {
4342  __pyx_t_15 += __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape;
4343  if (unlikely(__pyx_t_15 < 0)) __pyx_t_5 = 1;
4344  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape)) __pyx_t_5 = 1;
4345  if (unlikely(__pyx_t_5 != -1)) {
4346  __Pyx_RaiseBufferIndexError(__pyx_t_5);
4347  __PYX_ERR(0, 135, __pyx_L1_error)
4348  }
4349  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides) = __pyx_t_13;
4350  }
4351  }
4352 
4353  /* "subsurfaceTransportFunctions.pyx":118
4354  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
4355  *
4356  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
4357  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
4358  * numpy.ndarray[DTYPE_t,ndim=2] ebq_global_vals,
4359  */
4360 
4361  /* function exit code */
4362  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4363  goto __pyx_L0;
4364  __pyx_L1_error:;
4365  __Pyx_XDECREF(__pyx_t_10);
4366  __Pyx_XDECREF(__pyx_t_11);
4367  __Pyx_XDECREF(__pyx_t_12);
4368  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
4369  __Pyx_PyThreadState_declare
4370  __Pyx_PyThreadState_assign
4371  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
4372  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
4373  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4374  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4375  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
4376  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4377  __pyx_r = NULL;
4378  goto __pyx_L2;
4379  __pyx_L0:;
4380  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
4381  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4382  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4383  __pyx_L2:;
4384  __Pyx_XGIVEREF(__pyx_r);
4385  __Pyx_RefNannyFinishContext();
4386  return __pyx_r;
4387 }
4388 
4389 /* "subsurfaceTransportFunctions.pyx":139
4390  *
4391  *
4392  * def setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
4393  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
4394  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
4395  */
4396 
4397 /* Python wrapper */
4398 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4399 static char __pyx_doc_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage[] = "\n loop over quadrature array and evaluate function \ten f_{mn} = f^L_{j,mn}f^R_{k,mn}/(f^L_{j,mn}+f^R_{k,mn})\n assuming element on left is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
4400 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage = {"setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage};
4401 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4402  int __pyx_v_nd;
4403  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray = 0;
4404  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
4405  PyArrayObject *__pyx_v_ebq_global_vals = 0;
4406  PyObject *__pyx_v_material_functions = 0;
4407  PyObject *__pyx_r = 0;
4408  __Pyx_RefNannyDeclarations
4409  __Pyx_RefNannySetupContext("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage (wrapper)", 0);
4410  {
4411  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nd,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_ebq_global_vals,&__pyx_n_s_material_functions,0};
4412  PyObject* values[5] = {0,0,0,0,0};
4413  if (unlikely(__pyx_kwds)) {
4414  Py_ssize_t kw_args;
4415  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4416  switch (pos_args) {
4417  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4418  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4419  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4420  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4421  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4422  case 0: break;
4423  default: goto __pyx_L5_argtuple_error;
4424  }
4425  kw_args = PyDict_Size(__pyx_kwds);
4426  switch (pos_args) {
4427  case 0:
4428  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
4429  else goto __pyx_L5_argtuple_error;
4430  case 1:
4431  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
4432  else {
4433  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, 1); __PYX_ERR(0, 139, __pyx_L3_error)
4434  }
4435  case 2:
4436  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
4437  else {
4438  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, 2); __PYX_ERR(0, 139, __pyx_L3_error)
4439  }
4440  case 3:
4441  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ebq_global_vals)) != 0)) kw_args--;
4442  else {
4443  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, 3); __PYX_ERR(0, 139, __pyx_L3_error)
4444  }
4445  case 4:
4446  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
4447  else {
4448  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, 4); __PYX_ERR(0, 139, __pyx_L3_error)
4449  }
4450  }
4451  if (unlikely(kw_args > 0)) {
4452  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage") < 0)) __PYX_ERR(0, 139, __pyx_L3_error)
4453  }
4454  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
4455  goto __pyx_L5_argtuple_error;
4456  } else {
4457  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4458  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4459  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4460  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4461  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4462  }
4463  __pyx_v_nd = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L3_error)
4464  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[1]);
4465  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[2]);
4466  __pyx_v_ebq_global_vals = ((PyArrayObject *)values[3]);
4467  __pyx_v_material_functions = ((PyObject*)values[4]);
4468  }
4469  goto __pyx_L4_argument_unpacking_done;
4470  __pyx_L5_argtuple_error:;
4471  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 139, __pyx_L3_error)
4472  __pyx_L3_error:;
4473  __Pyx_AddTraceback("subsurfaceTransportFunctions.setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4474  __Pyx_RefNannyFinishContext();
4475  return NULL;
4476  __pyx_L4_argument_unpacking_done:;
4477  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 140, __pyx_L1_error)
4478  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 141, __pyx_L1_error)
4479  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_global_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_global_vals", 0))) __PYX_ERR(0, 142, __pyx_L1_error)
4480  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 143, __pyx_L1_error)
4481  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(__pyx_self, __pyx_v_nd, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_ebq_global_vals, __pyx_v_material_functions);
4482 
4483  /* function exit code */
4484  goto __pyx_L0;
4485  __pyx_L1_error:;
4486  __pyx_r = NULL;
4487  __pyx_L0:;
4488  __Pyx_RefNannyFinishContext();
4489  return __pyx_r;
4490 }
4491 
4492 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions) {
4493  int __pyx_v_ebN;
4494  int __pyx_v_k;
4495  int __pyx_v_material_left;
4496  int __pyx_v_material_right;
4497  int __pyx_v_I;
4498  int __pyx_v_J;
4499  double __pyx_v_numer;
4500  double __pyx_v_denom;
4501  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_global_vals;
4502  __Pyx_Buffer __pyx_pybuffer_ebq_global_vals;
4503  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
4504  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
4505  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
4506  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
4507  PyObject *__pyx_r = NULL;
4508  __Pyx_RefNannyDeclarations
4509  npy_intp __pyx_t_1;
4510  int __pyx_t_2;
4511  Py_ssize_t __pyx_t_3;
4512  Py_ssize_t __pyx_t_4;
4513  int __pyx_t_5;
4514  Py_ssize_t __pyx_t_6;
4515  Py_ssize_t __pyx_t_7;
4516  npy_intp __pyx_t_8;
4517  int __pyx_t_9;
4518  int __pyx_t_10;
4519  int __pyx_t_11;
4520  int __pyx_t_12;
4521  PyObject *__pyx_t_13 = NULL;
4522  PyObject *__pyx_t_14 = NULL;
4523  PyObject *__pyx_t_15 = NULL;
4524  PyObject *__pyx_t_16 = NULL;
4525  PyObject *__pyx_t_17 = NULL;
4526  double __pyx_t_18;
4527  Py_ssize_t __pyx_t_19;
4528  Py_ssize_t __pyx_t_20;
4529  Py_ssize_t __pyx_t_21;
4530  int __pyx_t_22;
4531  __Pyx_RefNannySetupContext("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 0);
4532  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
4533  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
4534  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
4535  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
4536  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
4537  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
4538  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
4539  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
4540  __pyx_pybuffer_ebq_global_vals.pybuffer.buf = NULL;
4541  __pyx_pybuffer_ebq_global_vals.refcount = 0;
4542  __pyx_pybuffernd_ebq_global_vals.data = NULL;
4543  __pyx_pybuffernd_ebq_global_vals.rcbuffer = &__pyx_pybuffer_ebq_global_vals;
4544  {
4545  __Pyx_BufFmt_StackElem __pyx_stack[1];
4546  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 139, __pyx_L1_error)
4547  }
4548  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
4549  {
4550  __Pyx_BufFmt_StackElem __pyx_stack[1];
4551  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 139, __pyx_L1_error)
4552  }
4553  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
4554  {
4555  __Pyx_BufFmt_StackElem __pyx_stack[1];
4556  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_global_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 139, __pyx_L1_error)
4557  }
4558  __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[2];
4559 
4560  /* "subsurfaceTransportFunctions.pyx":154
4561  * cdef double numer,denom
4562  *
4563  * for ebN in range(ebq_global_vals.shape[0]): # <<<<<<<<<<<<<<
4564  * material_left = elementBoundaryTypes[ebN,0]
4565  * material_right= elementBoundaryTypes[ebN,1]
4566  */
4567  __pyx_t_1 = (__pyx_v_ebq_global_vals->dimensions[0]);
4568  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
4569  __pyx_v_ebN = __pyx_t_2;
4570 
4571  /* "subsurfaceTransportFunctions.pyx":155
4572  *
4573  * for ebN in range(ebq_global_vals.shape[0]):
4574  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
4575  * material_right= elementBoundaryTypes[ebN,1]
4576  * for k in range(ebq_global_vals.shape[1]):
4577  */
4578  __pyx_t_3 = __pyx_v_ebN;
4579  __pyx_t_4 = 0;
4580  __pyx_t_5 = -1;
4581  if (__pyx_t_3 < 0) {
4582  __pyx_t_3 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4583  if (unlikely(__pyx_t_3 < 0)) __pyx_t_5 = 0;
4584  } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_5 = 0;
4585  if (__pyx_t_4 < 0) {
4586  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4587  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 1;
4588  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_5 = 1;
4589  if (unlikely(__pyx_t_5 != -1)) {
4590  __Pyx_RaiseBufferIndexError(__pyx_t_5);
4591  __PYX_ERR(0, 155, __pyx_L1_error)
4592  }
4593  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4594 
4595  /* "subsurfaceTransportFunctions.pyx":156
4596  * for ebN in range(ebq_global_vals.shape[0]):
4597  * material_left = elementBoundaryTypes[ebN,0]
4598  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
4599  * for k in range(ebq_global_vals.shape[1]):
4600  * for I in range(nd):
4601  */
4602  __pyx_t_6 = __pyx_v_ebN;
4603  __pyx_t_7 = 1;
4604  __pyx_t_5 = -1;
4605  if (__pyx_t_6 < 0) {
4606  __pyx_t_6 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4607  if (unlikely(__pyx_t_6 < 0)) __pyx_t_5 = 0;
4608  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_5 = 0;
4609  if (__pyx_t_7 < 0) {
4610  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4611  if (unlikely(__pyx_t_7 < 0)) __pyx_t_5 = 1;
4612  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_5 = 1;
4613  if (unlikely(__pyx_t_5 != -1)) {
4614  __Pyx_RaiseBufferIndexError(__pyx_t_5);
4615  __PYX_ERR(0, 156, __pyx_L1_error)
4616  }
4617  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4618 
4619  /* "subsurfaceTransportFunctions.pyx":157
4620  * material_left = elementBoundaryTypes[ebN,0]
4621  * material_right= elementBoundaryTypes[ebN,1]
4622  * for k in range(ebq_global_vals.shape[1]): # <<<<<<<<<<<<<<
4623  * for I in range(nd):
4624  * for J in range(nd):
4625  */
4626  __pyx_t_8 = (__pyx_v_ebq_global_vals->dimensions[1]);
4627  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_8; __pyx_t_5+=1) {
4628  __pyx_v_k = __pyx_t_5;
4629 
4630  /* "subsurfaceTransportFunctions.pyx":158
4631  * material_right= elementBoundaryTypes[ebN,1]
4632  * for k in range(ebq_global_vals.shape[1]):
4633  * for I in range(nd): # <<<<<<<<<<<<<<
4634  * for J in range(nd):
4635  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4636  */
4637  __pyx_t_9 = __pyx_v_nd;
4638  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
4639  __pyx_v_I = __pyx_t_10;
4640 
4641  /* "subsurfaceTransportFunctions.pyx":159
4642  * for k in range(ebq_global_vals.shape[1]):
4643  * for I in range(nd):
4644  * for J in range(nd): # <<<<<<<<<<<<<<
4645  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4646  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
4647  */
4648  __pyx_t_11 = __pyx_v_nd;
4649  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
4650  __pyx_v_J = __pyx_t_12;
4651 
4652  /* "subsurfaceTransportFunctions.pyx":160
4653  * for I in range(nd):
4654  * for J in range(nd):
4655  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J] # <<<<<<<<<<<<<<
4656  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
4657  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom
4658  */
4659  if (unlikely(__pyx_v_material_functions == Py_None)) {
4660  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4661  __PYX_ERR(0, 160, __pyx_L1_error)
4662  }
4663  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 160, __pyx_L1_error)
4664  __Pyx_GOTREF(__pyx_t_13);
4665  __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 160, __pyx_L1_error)
4666  __Pyx_GOTREF(__pyx_t_14);
4667  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
4668  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 160, __pyx_L1_error)
4669  __Pyx_GOTREF(__pyx_t_13);
4670  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 160, __pyx_L1_error)
4671  __Pyx_GOTREF(__pyx_t_15);
4672  __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 160, __pyx_L1_error)
4673  __Pyx_GOTREF(__pyx_t_16);
4674  __Pyx_GIVEREF(__pyx_t_13);
4675  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_13);
4676  __Pyx_GIVEREF(__pyx_t_15);
4677  PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_15);
4678  __pyx_t_13 = 0;
4679  __pyx_t_15 = 0;
4680  __pyx_t_15 = PyObject_GetItem(__pyx_t_14, __pyx_t_16); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 160, __pyx_L1_error)
4681  __Pyx_GOTREF(__pyx_t_15);
4682  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
4683  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
4684  __pyx_t_16 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 160, __pyx_L1_error)
4685  __Pyx_GOTREF(__pyx_t_16);
4686  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
4687  if (unlikely(__pyx_v_material_functions == Py_None)) {
4688  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4689  __PYX_ERR(0, 160, __pyx_L1_error)
4690  }
4691  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 160, __pyx_L1_error)
4692  __Pyx_GOTREF(__pyx_t_15);
4693  __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_15); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 160, __pyx_L1_error)
4694  __Pyx_GOTREF(__pyx_t_14);
4695  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
4696  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 160, __pyx_L1_error)
4697  __Pyx_GOTREF(__pyx_t_15);
4698  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 160, __pyx_L1_error)
4699  __Pyx_GOTREF(__pyx_t_13);
4700  __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 160, __pyx_L1_error)
4701  __Pyx_GOTREF(__pyx_t_17);
4702  __Pyx_GIVEREF(__pyx_t_15);
4703  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_15);
4704  __Pyx_GIVEREF(__pyx_t_13);
4705  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_13);
4706  __pyx_t_15 = 0;
4707  __pyx_t_13 = 0;
4708  __pyx_t_13 = PyObject_GetItem(__pyx_t_14, __pyx_t_17); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 160, __pyx_L1_error)
4709  __Pyx_GOTREF(__pyx_t_13);
4710  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
4711  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
4712  __pyx_t_17 = PyNumber_Multiply(__pyx_t_16, __pyx_t_13); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 160, __pyx_L1_error)
4713  __Pyx_GOTREF(__pyx_t_17);
4714  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
4715  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
4716  __pyx_t_18 = __pyx_PyFloat_AsDouble(__pyx_t_17); if (unlikely((__pyx_t_18 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 160, __pyx_L1_error)
4717  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
4718  __pyx_v_numer = __pyx_t_18;
4719 
4720  /* "subsurfaceTransportFunctions.pyx":161
4721  * for J in range(nd):
4722  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4723  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20 # <<<<<<<<<<<<<<
4724  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom
4725  *
4726  */
4727  if (unlikely(__pyx_v_material_functions == Py_None)) {
4728  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4729  __PYX_ERR(0, 161, __pyx_L1_error)
4730  }
4731  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 161, __pyx_L1_error)
4732  __Pyx_GOTREF(__pyx_t_17);
4733  __pyx_t_13 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_17); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 161, __pyx_L1_error)
4734  __Pyx_GOTREF(__pyx_t_13);
4735  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
4736  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 161, __pyx_L1_error)
4737  __Pyx_GOTREF(__pyx_t_17);
4738  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 161, __pyx_L1_error)
4739  __Pyx_GOTREF(__pyx_t_16);
4740  __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 161, __pyx_L1_error)
4741  __Pyx_GOTREF(__pyx_t_14);
4742  __Pyx_GIVEREF(__pyx_t_17);
4743  PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_17);
4744  __Pyx_GIVEREF(__pyx_t_16);
4745  PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_16);
4746  __pyx_t_17 = 0;
4747  __pyx_t_16 = 0;
4748  __pyx_t_16 = PyObject_GetItem(__pyx_t_13, __pyx_t_14); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 161, __pyx_L1_error)
4749  __Pyx_GOTREF(__pyx_t_16);
4750  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
4751  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
4752  if (unlikely(__pyx_v_material_functions == Py_None)) {
4753  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4754  __PYX_ERR(0, 161, __pyx_L1_error)
4755  }
4756  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 161, __pyx_L1_error)
4757  __Pyx_GOTREF(__pyx_t_14);
4758  __pyx_t_13 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_14); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 161, __pyx_L1_error)
4759  __Pyx_GOTREF(__pyx_t_13);
4760  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
4761  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 161, __pyx_L1_error)
4762  __Pyx_GOTREF(__pyx_t_14);
4763  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 161, __pyx_L1_error)
4764  __Pyx_GOTREF(__pyx_t_17);
4765  __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 161, __pyx_L1_error)
4766  __Pyx_GOTREF(__pyx_t_15);
4767  __Pyx_GIVEREF(__pyx_t_14);
4768  PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_14);
4769  __Pyx_GIVEREF(__pyx_t_17);
4770  PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_17);
4771  __pyx_t_14 = 0;
4772  __pyx_t_17 = 0;
4773  __pyx_t_17 = PyObject_GetItem(__pyx_t_13, __pyx_t_15); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 161, __pyx_L1_error)
4774  __Pyx_GOTREF(__pyx_t_17);
4775  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
4776  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
4777  __pyx_t_15 = PyNumber_Add(__pyx_t_16, __pyx_t_17); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 161, __pyx_L1_error)
4778  __Pyx_GOTREF(__pyx_t_15);
4779  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
4780  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
4781  __pyx_t_17 = __Pyx_PyFloat_AddObjC(__pyx_t_15, __pyx_float_1_0eneg_20, 1.0e-20, 0); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 161, __pyx_L1_error)
4782  __Pyx_GOTREF(__pyx_t_17);
4783  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
4784  __pyx_t_18 = __pyx_PyFloat_AsDouble(__pyx_t_17); if (unlikely((__pyx_t_18 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 161, __pyx_L1_error)
4785  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
4786  __pyx_v_denom = __pyx_t_18;
4787 
4788  /* "subsurfaceTransportFunctions.pyx":162
4789  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4790  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
4791  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom # <<<<<<<<<<<<<<
4792  *
4793  * ###
4794  */
4795  if (unlikely(__pyx_v_denom == 0)) {
4796  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
4797  __PYX_ERR(0, 162, __pyx_L1_error)
4798  }
4799  __pyx_t_19 = __pyx_v_ebN;
4800  __pyx_t_20 = __pyx_v_k;
4801  __pyx_t_21 = ((__pyx_v_I * __pyx_v_nd) + __pyx_v_J);
4802  __pyx_t_22 = -1;
4803  if (__pyx_t_19 < 0) {
4804  __pyx_t_19 += __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape;
4805  if (unlikely(__pyx_t_19 < 0)) __pyx_t_22 = 0;
4806  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape)) __pyx_t_22 = 0;
4807  if (__pyx_t_20 < 0) {
4808  __pyx_t_20 += __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape;
4809  if (unlikely(__pyx_t_20 < 0)) __pyx_t_22 = 1;
4810  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape)) __pyx_t_22 = 1;
4811  if (__pyx_t_21 < 0) {
4812  __pyx_t_21 += __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape;
4813  if (unlikely(__pyx_t_21 < 0)) __pyx_t_22 = 2;
4814  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape)) __pyx_t_22 = 2;
4815  if (unlikely(__pyx_t_22 != -1)) {
4816  __Pyx_RaiseBufferIndexError(__pyx_t_22);
4817  __PYX_ERR(0, 162, __pyx_L1_error)
4818  }
4819  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides, __pyx_t_21, __pyx_pybuffernd_ebq_global_vals.diminfo[2].strides) = (__pyx_v_numer / __pyx_v_denom);
4820  }
4821  }
4822  }
4823  }
4824 
4825  /* "subsurfaceTransportFunctions.pyx":139
4826  *
4827  *
4828  * def setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
4829  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
4830  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
4831  */
4832 
4833  /* function exit code */
4834  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4835  goto __pyx_L0;
4836  __pyx_L1_error:;
4837  __Pyx_XDECREF(__pyx_t_13);
4838  __Pyx_XDECREF(__pyx_t_14);
4839  __Pyx_XDECREF(__pyx_t_15);
4840  __Pyx_XDECREF(__pyx_t_16);
4841  __Pyx_XDECREF(__pyx_t_17);
4842  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
4843  __Pyx_PyThreadState_declare
4844  __Pyx_PyThreadState_assign
4845  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
4846  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
4847  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4848  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4849  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
4850  __Pyx_AddTraceback("subsurfaceTransportFunctions.setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4851  __pyx_r = NULL;
4852  goto __pyx_L2;
4853  __pyx_L0:;
4854  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
4855  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4856  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4857  __pyx_L2:;
4858  __Pyx_XGIVEREF(__pyx_r);
4859  __Pyx_RefNannyFinishContext();
4860  return __pyx_r;
4861 }
4862 
4863 /* "subsurfaceTransportFunctions.pyx":165
4864  *
4865  * ###
4866  * def evaluateScalarMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
4867  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
4868  * numpy.ndarray[DTYPE_t,ndim=3] x,
4869  */
4870 
4871 /* Python wrapper */
4872 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4873 static char __pyx_doc_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements[] = "\n loop over quadrature array and evaluate function f_j(x,t) assuming element is material j\n likely little improvement right now without correct typing of material_functions\n ";
4874 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements = {"evaluateScalarMaterialFunctionOverElements", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements};
4875 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4876  double __pyx_v_t;
4877  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
4878  PyArrayObject *__pyx_v_x = 0;
4879  PyArrayObject *__pyx_v_q_vals = 0;
4880  PyObject *__pyx_v_material_functions = 0;
4881  PyObject *__pyx_r = 0;
4882  __Pyx_RefNannyDeclarations
4883  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverElements (wrapper)", 0);
4884  {
4885  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_x,&__pyx_n_s_q_vals,&__pyx_n_s_material_functions,0};
4886  PyObject* values[5] = {0,0,0,0,0};
4887  if (unlikely(__pyx_kwds)) {
4888  Py_ssize_t kw_args;
4889  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4890  switch (pos_args) {
4891  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4892  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4893  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4894  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4895  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4896  case 0: break;
4897  default: goto __pyx_L5_argtuple_error;
4898  }
4899  kw_args = PyDict_Size(__pyx_kwds);
4900  switch (pos_args) {
4901  case 0:
4902  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
4903  else goto __pyx_L5_argtuple_error;
4904  case 1:
4905  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
4906  else {
4907  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, 1); __PYX_ERR(0, 165, __pyx_L3_error)
4908  }
4909  case 2:
4910  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
4911  else {
4912  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, 2); __PYX_ERR(0, 165, __pyx_L3_error)
4913  }
4914  case 3:
4915  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_vals)) != 0)) kw_args--;
4916  else {
4917  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, 3); __PYX_ERR(0, 165, __pyx_L3_error)
4918  }
4919  case 4:
4920  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
4921  else {
4922  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, 4); __PYX_ERR(0, 165, __pyx_L3_error)
4923  }
4924  }
4925  if (unlikely(kw_args > 0)) {
4926  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateScalarMaterialFunctionOverElements") < 0)) __PYX_ERR(0, 165, __pyx_L3_error)
4927  }
4928  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
4929  goto __pyx_L5_argtuple_error;
4930  } else {
4931  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4932  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4933  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4934  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4935  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4936  }
4937  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 165, __pyx_L3_error)
4938  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[1]);
4939  __pyx_v_x = ((PyArrayObject *)values[2]);
4940  __pyx_v_q_vals = ((PyArrayObject *)values[3]);
4941  __pyx_v_material_functions = ((PyObject*)values[4]);
4942  }
4943  goto __pyx_L4_argument_unpacking_done;
4944  __pyx_L5_argtuple_error:;
4945  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 165, __pyx_L3_error)
4946  __pyx_L3_error:;
4947  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
4948  __Pyx_RefNannyFinishContext();
4949  return NULL;
4950  __pyx_L4_argument_unpacking_done:;
4951  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 166, __pyx_L1_error)
4952  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 167, __pyx_L1_error)
4953  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_vals), __pyx_ptype_5numpy_ndarray, 1, "q_vals", 0))) __PYX_ERR(0, 168, __pyx_L1_error)
4954  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 169, __pyx_L1_error)
4955  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements(__pyx_self, __pyx_v_t, __pyx_v_elementMaterialTypes, __pyx_v_x, __pyx_v_q_vals, __pyx_v_material_functions);
4956 
4957  /* function exit code */
4958  goto __pyx_L0;
4959  __pyx_L1_error:;
4960  __pyx_r = NULL;
4961  __pyx_L0:;
4962  __Pyx_RefNannyFinishContext();
4963  return __pyx_r;
4964 }
4965 
4966 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions) {
4967  int __pyx_v_eN;
4968  int __pyx_v_k;
4969  int __pyx_v_material;
4970  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
4971  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
4972  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_vals;
4973  __Pyx_Buffer __pyx_pybuffer_q_vals;
4974  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
4975  __Pyx_Buffer __pyx_pybuffer_x;
4976  PyObject *__pyx_r = NULL;
4977  __Pyx_RefNannyDeclarations
4978  npy_intp __pyx_t_1;
4979  int __pyx_t_2;
4980  Py_ssize_t __pyx_t_3;
4981  int __pyx_t_4;
4982  npy_intp __pyx_t_5;
4983  PyObject *__pyx_t_6 = NULL;
4984  PyObject *__pyx_t_7 = NULL;
4985  PyObject *__pyx_t_8 = NULL;
4986  PyObject *__pyx_t_9 = NULL;
4987  PyObject *__pyx_t_10 = NULL;
4988  int __pyx_t_11;
4989  PyObject *__pyx_t_12 = NULL;
4990  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_13;
4991  Py_ssize_t __pyx_t_14;
4992  Py_ssize_t __pyx_t_15;
4993  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverElements", 0);
4994  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
4995  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
4996  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
4997  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
4998  __pyx_pybuffer_x.pybuffer.buf = NULL;
4999  __pyx_pybuffer_x.refcount = 0;
5000  __pyx_pybuffernd_x.data = NULL;
5001  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
5002  __pyx_pybuffer_q_vals.pybuffer.buf = NULL;
5003  __pyx_pybuffer_q_vals.refcount = 0;
5004  __pyx_pybuffernd_q_vals.data = NULL;
5005  __pyx_pybuffernd_q_vals.rcbuffer = &__pyx_pybuffer_q_vals;
5006  {
5007  __Pyx_BufFmt_StackElem __pyx_stack[1];
5008  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 165, __pyx_L1_error)
5009  }
5010  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
5011  {
5012  __Pyx_BufFmt_StackElem __pyx_stack[1];
5013  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 165, __pyx_L1_error)
5014  }
5015  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
5016  {
5017  __Pyx_BufFmt_StackElem __pyx_stack[1];
5018  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 165, __pyx_L1_error)
5019  }
5020  __pyx_pybuffernd_q_vals.diminfo[0].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_vals.diminfo[0].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_vals.diminfo[1].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_vals.diminfo[1].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[1];
5021 
5022  /* "subsurfaceTransportFunctions.pyx":175
5023  * """
5024  * cdef int eN,k,material
5025  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
5026  * material = elementMaterialTypes[eN]
5027  * for k in range(x.shape[1]):
5028  */
5029  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
5030  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
5031  __pyx_v_eN = __pyx_t_2;
5032 
5033  /* "subsurfaceTransportFunctions.pyx":176
5034  * cdef int eN,k,material
5035  * for eN in range(x.shape[0]):
5036  * material = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
5037  * for k in range(x.shape[1]):
5038  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
5039  */
5040  __pyx_t_3 = __pyx_v_eN;
5041  __pyx_t_4 = -1;
5042  if (__pyx_t_3 < 0) {
5043  __pyx_t_3 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
5044  if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0;
5045  } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_4 = 0;
5046  if (unlikely(__pyx_t_4 != -1)) {
5047  __Pyx_RaiseBufferIndexError(__pyx_t_4);
5048  __PYX_ERR(0, 176, __pyx_L1_error)
5049  }
5050  __pyx_v_material = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
5051 
5052  /* "subsurfaceTransportFunctions.pyx":177
5053  * for eN in range(x.shape[0]):
5054  * material = elementMaterialTypes[eN]
5055  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
5056  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
5057  *
5058  */
5059  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
5060  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_5; __pyx_t_4+=1) {
5061  __pyx_v_k = __pyx_t_4;
5062 
5063  /* "subsurfaceTransportFunctions.pyx":178
5064  * material = elementMaterialTypes[eN]
5065  * for k in range(x.shape[1]):
5066  * q_vals[eN,k] = material_functions[material](x[eN,k],t) # <<<<<<<<<<<<<<
5067  *
5068  * def evaluateVectorMaterialFunctionOverElements(double t,
5069  */
5070  if (unlikely(__pyx_v_material_functions == Py_None)) {
5071  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5072  __PYX_ERR(0, 178, __pyx_L1_error)
5073  }
5074  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_material); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 178, __pyx_L1_error)
5075  __Pyx_GOTREF(__pyx_t_7);
5076  __pyx_t_8 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 178, __pyx_L1_error)
5077  __Pyx_GOTREF(__pyx_t_8);
5078  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5079  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 178, __pyx_L1_error)
5080  __Pyx_GOTREF(__pyx_t_7);
5081  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 178, __pyx_L1_error)
5082  __Pyx_GOTREF(__pyx_t_9);
5083  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 178, __pyx_L1_error)
5084  __Pyx_GOTREF(__pyx_t_10);
5085  __Pyx_GIVEREF(__pyx_t_7);
5086  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7);
5087  __Pyx_GIVEREF(__pyx_t_9);
5088  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9);
5089  __pyx_t_7 = 0;
5090  __pyx_t_9 = 0;
5091  __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 178, __pyx_L1_error)
5092  __Pyx_GOTREF(__pyx_t_9);
5093  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5094  __pyx_t_10 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 178, __pyx_L1_error)
5095  __Pyx_GOTREF(__pyx_t_10);
5096  __pyx_t_7 = NULL;
5097  __pyx_t_11 = 0;
5098  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
5099  __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
5100  if (likely(__pyx_t_7)) {
5101  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
5102  __Pyx_INCREF(__pyx_t_7);
5103  __Pyx_INCREF(function);
5104  __Pyx_DECREF_SET(__pyx_t_8, function);
5105  __pyx_t_11 = 1;
5106  }
5107  }
5108  #if CYTHON_FAST_PYCALL
5109  if (PyFunction_Check(__pyx_t_8)) {
5110  PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_9, __pyx_t_10};
5111  __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 178, __pyx_L1_error)
5112  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
5113  __Pyx_GOTREF(__pyx_t_6);
5114  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5115  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5116  } else
5117  #endif
5118  #if CYTHON_FAST_PYCCALL
5119  if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
5120  PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_9, __pyx_t_10};
5121  __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 178, __pyx_L1_error)
5122  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
5123  __Pyx_GOTREF(__pyx_t_6);
5124  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5125  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5126  } else
5127  #endif
5128  {
5129  __pyx_t_12 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 178, __pyx_L1_error)
5130  __Pyx_GOTREF(__pyx_t_12);
5131  if (__pyx_t_7) {
5132  __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_7); __pyx_t_7 = NULL;
5133  }
5134  __Pyx_GIVEREF(__pyx_t_9);
5135  PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_9);
5136  __Pyx_GIVEREF(__pyx_t_10);
5137  PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_t_10);
5138  __pyx_t_9 = 0;
5139  __pyx_t_10 = 0;
5140  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 178, __pyx_L1_error)
5141  __Pyx_GOTREF(__pyx_t_6);
5142  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5143  }
5144  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5145  __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_13 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L1_error)
5146  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5147  __pyx_t_14 = __pyx_v_eN;
5148  __pyx_t_15 = __pyx_v_k;
5149  __pyx_t_11 = -1;
5150  if (__pyx_t_14 < 0) {
5151  __pyx_t_14 += __pyx_pybuffernd_q_vals.diminfo[0].shape;
5152  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 0;
5153  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_q_vals.diminfo[0].shape)) __pyx_t_11 = 0;
5154  if (__pyx_t_15 < 0) {
5155  __pyx_t_15 += __pyx_pybuffernd_q_vals.diminfo[1].shape;
5156  if (unlikely(__pyx_t_15 < 0)) __pyx_t_11 = 1;
5157  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_vals.diminfo[1].shape)) __pyx_t_11 = 1;
5158  if (unlikely(__pyx_t_11 != -1)) {
5159  __Pyx_RaiseBufferIndexError(__pyx_t_11);
5160  __PYX_ERR(0, 178, __pyx_L1_error)
5161  }
5162  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_q_vals.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_vals.diminfo[1].strides) = __pyx_t_13;
5163  }
5164  }
5165 
5166  /* "subsurfaceTransportFunctions.pyx":165
5167  *
5168  * ###
5169  * def evaluateScalarMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
5170  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
5171  * numpy.ndarray[DTYPE_t,ndim=3] x,
5172  */
5173 
5174  /* function exit code */
5175  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5176  goto __pyx_L0;
5177  __pyx_L1_error:;
5178  __Pyx_XDECREF(__pyx_t_6);
5179  __Pyx_XDECREF(__pyx_t_7);
5180  __Pyx_XDECREF(__pyx_t_8);
5181  __Pyx_XDECREF(__pyx_t_9);
5182  __Pyx_XDECREF(__pyx_t_10);
5183  __Pyx_XDECREF(__pyx_t_12);
5184  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
5185  __Pyx_PyThreadState_declare
5186  __Pyx_PyThreadState_assign
5187  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
5188  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
5189  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
5190  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
5191  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
5192  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
5193  __pyx_r = NULL;
5194  goto __pyx_L2;
5195  __pyx_L0:;
5196  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
5197  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
5198  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
5199  __pyx_L2:;
5200  __Pyx_XGIVEREF(__pyx_r);
5201  __Pyx_RefNannyFinishContext();
5202  return __pyx_r;
5203 }
5204 
5205 /* "subsurfaceTransportFunctions.pyx":180
5206  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
5207  *
5208  * def evaluateVectorMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
5209  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
5210  * numpy.ndarray[DTYPE_t,ndim=3] x,
5211  */
5212 
5213 /* Python wrapper */
5214 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5215 static char __pyx_doc_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements[] = "\n loop over quadrature array and evaluate function \013ec f_j(x,t) assuming element is material j\n ";
5216 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements = {"evaluateVectorMaterialFunctionOverElements", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements};
5217 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5218  double __pyx_v_t;
5219  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
5220  PyArrayObject *__pyx_v_x = 0;
5221  PyArrayObject *__pyx_v_q_vals = 0;
5222  PyObject *__pyx_v_material_functions = 0;
5223  PyObject *__pyx_r = 0;
5224  __Pyx_RefNannyDeclarations
5225  __Pyx_RefNannySetupContext("evaluateVectorMaterialFunctionOverElements (wrapper)", 0);
5226  {
5227  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_x,&__pyx_n_s_q_vals,&__pyx_n_s_material_functions,0};
5228  PyObject* values[5] = {0,0,0,0,0};
5229  if (unlikely(__pyx_kwds)) {
5230  Py_ssize_t kw_args;
5231  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5232  switch (pos_args) {
5233  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5234  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5235  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5236  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5237  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5238  case 0: break;
5239  default: goto __pyx_L5_argtuple_error;
5240  }
5241  kw_args = PyDict_Size(__pyx_kwds);
5242  switch (pos_args) {
5243  case 0:
5244  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
5245  else goto __pyx_L5_argtuple_error;
5246  case 1:
5247  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
5248  else {
5249  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, 1); __PYX_ERR(0, 180, __pyx_L3_error)
5250  }
5251  case 2:
5252  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
5253  else {
5254  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, 2); __PYX_ERR(0, 180, __pyx_L3_error)
5255  }
5256  case 3:
5257  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_vals)) != 0)) kw_args--;
5258  else {
5259  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, 3); __PYX_ERR(0, 180, __pyx_L3_error)
5260  }
5261  case 4:
5262  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
5263  else {
5264  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, 4); __PYX_ERR(0, 180, __pyx_L3_error)
5265  }
5266  }
5267  if (unlikely(kw_args > 0)) {
5268  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateVectorMaterialFunctionOverElements") < 0)) __PYX_ERR(0, 180, __pyx_L3_error)
5269  }
5270  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
5271  goto __pyx_L5_argtuple_error;
5272  } else {
5273  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5274  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5275  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5276  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5277  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5278  }
5279  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L3_error)
5280  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[1]);
5281  __pyx_v_x = ((PyArrayObject *)values[2]);
5282  __pyx_v_q_vals = ((PyArrayObject *)values[3]);
5283  __pyx_v_material_functions = ((PyObject*)values[4]);
5284  }
5285  goto __pyx_L4_argument_unpacking_done;
5286  __pyx_L5_argtuple_error:;
5287  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 180, __pyx_L3_error)
5288  __pyx_L3_error:;
5289  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateVectorMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
5290  __Pyx_RefNannyFinishContext();
5291  return NULL;
5292  __pyx_L4_argument_unpacking_done:;
5293  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 181, __pyx_L1_error)
5294  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 182, __pyx_L1_error)
5295  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_vals), __pyx_ptype_5numpy_ndarray, 1, "q_vals", 0))) __PYX_ERR(0, 183, __pyx_L1_error)
5296  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 184, __pyx_L1_error)
5297  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements(__pyx_self, __pyx_v_t, __pyx_v_elementMaterialTypes, __pyx_v_x, __pyx_v_q_vals, __pyx_v_material_functions);
5298 
5299  /* function exit code */
5300  goto __pyx_L0;
5301  __pyx_L1_error:;
5302  __pyx_r = NULL;
5303  __pyx_L0:;
5304  __Pyx_RefNannyFinishContext();
5305  return __pyx_r;
5306 }
5307 
5308 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions) {
5309  int __pyx_v_eN;
5310  int __pyx_v_k;
5311  int __pyx_v_material;
5312  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
5313  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
5314  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_vals;
5315  __Pyx_Buffer __pyx_pybuffer_q_vals;
5316  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
5317  __Pyx_Buffer __pyx_pybuffer_x;
5318  PyObject *__pyx_r = NULL;
5319  __Pyx_RefNannyDeclarations
5320  npy_intp __pyx_t_1;
5321  int __pyx_t_2;
5322  Py_ssize_t __pyx_t_3;
5323  int __pyx_t_4;
5324  npy_intp __pyx_t_5;
5325  PyObject *__pyx_t_6 = NULL;
5326  PyObject *__pyx_t_7 = NULL;
5327  PyObject *__pyx_t_8 = NULL;
5328  PyObject *__pyx_t_9 = NULL;
5329  PyObject *__pyx_t_10 = NULL;
5330  int __pyx_t_11;
5331  PyObject *__pyx_t_12 = NULL;
5332  __Pyx_RefNannySetupContext("evaluateVectorMaterialFunctionOverElements", 0);
5333  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
5334  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
5335  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
5336  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
5337  __pyx_pybuffer_x.pybuffer.buf = NULL;
5338  __pyx_pybuffer_x.refcount = 0;
5339  __pyx_pybuffernd_x.data = NULL;
5340  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
5341  __pyx_pybuffer_q_vals.pybuffer.buf = NULL;
5342  __pyx_pybuffer_q_vals.refcount = 0;
5343  __pyx_pybuffernd_q_vals.data = NULL;
5344  __pyx_pybuffernd_q_vals.rcbuffer = &__pyx_pybuffer_q_vals;
5345  {
5346  __Pyx_BufFmt_StackElem __pyx_stack[1];
5347  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 180, __pyx_L1_error)
5348  }
5349  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
5350  {
5351  __Pyx_BufFmt_StackElem __pyx_stack[1];
5352  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 180, __pyx_L1_error)
5353  }
5354  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
5355  {
5356  __Pyx_BufFmt_StackElem __pyx_stack[1];
5357  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 180, __pyx_L1_error)
5358  }
5359  __pyx_pybuffernd_q_vals.diminfo[0].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_vals.diminfo[0].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_vals.diminfo[1].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_vals.diminfo[1].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_vals.diminfo[2].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_vals.diminfo[2].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[2];
5360 
5361  /* "subsurfaceTransportFunctions.pyx":189
5362  * """
5363  * cdef int eN,k,material
5364  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
5365  * material = elementMaterialTypes[eN]
5366  * for k in range(x.shape[1]):
5367  */
5368  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
5369  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
5370  __pyx_v_eN = __pyx_t_2;
5371 
5372  /* "subsurfaceTransportFunctions.pyx":190
5373  * cdef int eN,k,material
5374  * for eN in range(x.shape[0]):
5375  * material = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
5376  * for k in range(x.shape[1]):
5377  * q_vals[eN,k,:] = material_functions[material](x[eN,k],t).flat
5378  */
5379  __pyx_t_3 = __pyx_v_eN;
5380  __pyx_t_4 = -1;
5381  if (__pyx_t_3 < 0) {
5382  __pyx_t_3 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
5383  if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0;
5384  } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_4 = 0;
5385  if (unlikely(__pyx_t_4 != -1)) {
5386  __Pyx_RaiseBufferIndexError(__pyx_t_4);
5387  __PYX_ERR(0, 190, __pyx_L1_error)
5388  }
5389  __pyx_v_material = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
5390 
5391  /* "subsurfaceTransportFunctions.pyx":191
5392  * for eN in range(x.shape[0]):
5393  * material = elementMaterialTypes[eN]
5394  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
5395  * q_vals[eN,k,:] = material_functions[material](x[eN,k],t).flat
5396  *
5397  */
5398  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
5399  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_5; __pyx_t_4+=1) {
5400  __pyx_v_k = __pyx_t_4;
5401 
5402  /* "subsurfaceTransportFunctions.pyx":192
5403  * material = elementMaterialTypes[eN]
5404  * for k in range(x.shape[1]):
5405  * q_vals[eN,k,:] = material_functions[material](x[eN,k],t).flat # <<<<<<<<<<<<<<
5406  *
5407  *
5408  */
5409  if (unlikely(__pyx_v_material_functions == Py_None)) {
5410  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5411  __PYX_ERR(0, 192, __pyx_L1_error)
5412  }
5413  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_material); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 192, __pyx_L1_error)
5414  __Pyx_GOTREF(__pyx_t_7);
5415  __pyx_t_8 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 192, __pyx_L1_error)
5416  __Pyx_GOTREF(__pyx_t_8);
5417  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5418  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 192, __pyx_L1_error)
5419  __Pyx_GOTREF(__pyx_t_7);
5420  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 192, __pyx_L1_error)
5421  __Pyx_GOTREF(__pyx_t_9);
5422  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 192, __pyx_L1_error)
5423  __Pyx_GOTREF(__pyx_t_10);
5424  __Pyx_GIVEREF(__pyx_t_7);
5425  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7);
5426  __Pyx_GIVEREF(__pyx_t_9);
5427  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9);
5428  __pyx_t_7 = 0;
5429  __pyx_t_9 = 0;
5430  __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 192, __pyx_L1_error)
5431  __Pyx_GOTREF(__pyx_t_9);
5432  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5433  __pyx_t_10 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 192, __pyx_L1_error)
5434  __Pyx_GOTREF(__pyx_t_10);
5435  __pyx_t_7 = NULL;
5436  __pyx_t_11 = 0;
5437  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
5438  __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
5439  if (likely(__pyx_t_7)) {
5440  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
5441  __Pyx_INCREF(__pyx_t_7);
5442  __Pyx_INCREF(function);
5443  __Pyx_DECREF_SET(__pyx_t_8, function);
5444  __pyx_t_11 = 1;
5445  }
5446  }
5447  #if CYTHON_FAST_PYCALL
5448  if (PyFunction_Check(__pyx_t_8)) {
5449  PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_9, __pyx_t_10};
5450  __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 192, __pyx_L1_error)
5451  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
5452  __Pyx_GOTREF(__pyx_t_6);
5453  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5454  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5455  } else
5456  #endif
5457  #if CYTHON_FAST_PYCCALL
5458  if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
5459  PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_9, __pyx_t_10};
5460  __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 192, __pyx_L1_error)
5461  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
5462  __Pyx_GOTREF(__pyx_t_6);
5463  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5464  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5465  } else
5466  #endif
5467  {
5468  __pyx_t_12 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 192, __pyx_L1_error)
5469  __Pyx_GOTREF(__pyx_t_12);
5470  if (__pyx_t_7) {
5471  __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_7); __pyx_t_7 = NULL;
5472  }
5473  __Pyx_GIVEREF(__pyx_t_9);
5474  PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_9);
5475  __Pyx_GIVEREF(__pyx_t_10);
5476  PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_t_10);
5477  __pyx_t_9 = 0;
5478  __pyx_t_10 = 0;
5479  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 192, __pyx_L1_error)
5480  __Pyx_GOTREF(__pyx_t_6);
5481  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5482  }
5483  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5484  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_flat); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 192, __pyx_L1_error)
5485  __Pyx_GOTREF(__pyx_t_8);
5486  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5487  __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 192, __pyx_L1_error)
5488  __Pyx_GOTREF(__pyx_t_6);
5489  __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 192, __pyx_L1_error)
5490  __Pyx_GOTREF(__pyx_t_12);
5491  __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 192, __pyx_L1_error)
5492  __Pyx_GOTREF(__pyx_t_10);
5493  __Pyx_GIVEREF(__pyx_t_6);
5494  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6);
5495  __Pyx_GIVEREF(__pyx_t_12);
5496  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_12);
5497  __Pyx_INCREF(__pyx_slice__2);
5498  __Pyx_GIVEREF(__pyx_slice__2);
5499  PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_slice__2);
5500  __pyx_t_6 = 0;
5501  __pyx_t_12 = 0;
5502  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_q_vals), __pyx_t_10, __pyx_t_8) < 0)) __PYX_ERR(0, 192, __pyx_L1_error)
5503  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5504  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5505  }
5506  }
5507 
5508  /* "subsurfaceTransportFunctions.pyx":180
5509  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
5510  *
5511  * def evaluateVectorMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
5512  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
5513  * numpy.ndarray[DTYPE_t,ndim=3] x,
5514  */
5515 
5516  /* function exit code */
5517  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5518  goto __pyx_L0;
5519  __pyx_L1_error:;
5520  __Pyx_XDECREF(__pyx_t_6);
5521  __Pyx_XDECREF(__pyx_t_7);
5522  __Pyx_XDECREF(__pyx_t_8);
5523  __Pyx_XDECREF(__pyx_t_9);
5524  __Pyx_XDECREF(__pyx_t_10);
5525  __Pyx_XDECREF(__pyx_t_12);
5526  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
5527  __Pyx_PyThreadState_declare
5528  __Pyx_PyThreadState_assign
5529  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
5530  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
5531  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
5532  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
5533  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
5534  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateVectorMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
5535  __pyx_r = NULL;
5536  goto __pyx_L2;
5537  __pyx_L0:;
5538  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
5539  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
5540  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
5541  __pyx_L2:;
5542  __Pyx_XGIVEREF(__pyx_r);
5543  __Pyx_RefNannyFinishContext();
5544  return __pyx_r;
5545 }
5546 
5547 /* "subsurfaceTransportFunctions.pyx":195
5548  *
5549  *
5550  * def evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
5551  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
5552  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
5553  */
5554 
5555 /* Python wrapper */
5556 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5557 static char __pyx_doc_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage[] = "\n loop over quadrature array and evaluate function f(x,t) = 0.5(f^L_j(x,t)+f^R_k(x,t)) assuming element on left \n is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
5558 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage = {"evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage};
5559 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5560  double __pyx_v_t;
5561  PyArrayObject *__pyx_v_elementBoundariesArray = 0;
5562  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
5563  PyArrayObject *__pyx_v_x = 0;
5564  PyArrayObject *__pyx_v_ebq_vals = 0;
5565  PyObject *__pyx_v_material_functions = 0;
5566  PyObject *__pyx_r = 0;
5567  __Pyx_RefNannyDeclarations
5568  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage (wrapper)", 0);
5569  {
5570  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_x,&__pyx_n_s_ebq_vals,&__pyx_n_s_material_functions,0};
5571  PyObject* values[6] = {0,0,0,0,0,0};
5572  if (unlikely(__pyx_kwds)) {
5573  Py_ssize_t kw_args;
5574  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5575  switch (pos_args) {
5576  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5577  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5578  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5579  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5580  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5581  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5582  case 0: break;
5583  default: goto __pyx_L5_argtuple_error;
5584  }
5585  kw_args = PyDict_Size(__pyx_kwds);
5586  switch (pos_args) {
5587  case 0:
5588  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
5589  else goto __pyx_L5_argtuple_error;
5590  case 1:
5591  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
5592  else {
5593  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 1); __PYX_ERR(0, 195, __pyx_L3_error)
5594  }
5595  case 2:
5596  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
5597  else {
5598  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 2); __PYX_ERR(0, 195, __pyx_L3_error)
5599  }
5600  case 3:
5601  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
5602  else {
5603  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 3); __PYX_ERR(0, 195, __pyx_L3_error)
5604  }
5605  case 4:
5606  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ebq_vals)) != 0)) kw_args--;
5607  else {
5608  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 4); __PYX_ERR(0, 195, __pyx_L3_error)
5609  }
5610  case 5:
5611  if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
5612  else {
5613  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 5); __PYX_ERR(0, 195, __pyx_L3_error)
5614  }
5615  }
5616  if (unlikely(kw_args > 0)) {
5617  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage") < 0)) __PYX_ERR(0, 195, __pyx_L3_error)
5618  }
5619  } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
5620  goto __pyx_L5_argtuple_error;
5621  } else {
5622  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5623  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5624  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5625  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5626  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5627  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5628  }
5629  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 195, __pyx_L3_error)
5630  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[1]);
5631  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[2]);
5632  __pyx_v_x = ((PyArrayObject *)values[3]);
5633  __pyx_v_ebq_vals = ((PyArrayObject *)values[4]);
5634  __pyx_v_material_functions = ((PyObject*)values[5]);
5635  }
5636  goto __pyx_L4_argument_unpacking_done;
5637  __pyx_L5_argtuple_error:;
5638  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 195, __pyx_L3_error)
5639  __pyx_L3_error:;
5640  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
5641  __Pyx_RefNannyFinishContext();
5642  return NULL;
5643  __pyx_L4_argument_unpacking_done:;
5644  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 196, __pyx_L1_error)
5645  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 197, __pyx_L1_error)
5646  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 198, __pyx_L1_error)
5647  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_vals", 0))) __PYX_ERR(0, 199, __pyx_L1_error)
5648  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 200, __pyx_L1_error)
5649  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(__pyx_self, __pyx_v_t, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_x, __pyx_v_ebq_vals, __pyx_v_material_functions);
5650 
5651  /* function exit code */
5652  goto __pyx_L0;
5653  __pyx_L1_error:;
5654  __pyx_r = NULL;
5655  __pyx_L0:;
5656  __Pyx_RefNannyFinishContext();
5657  return __pyx_r;
5658 }
5659 
5660 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions) {
5661  int __pyx_v_eN;
5662  int __pyx_v_ebN;
5663  int __pyx_v_ebN_local;
5664  int __pyx_v_k;
5665  int __pyx_v_material_left;
5666  int __pyx_v_material_right;
5667  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_vals;
5668  __Pyx_Buffer __pyx_pybuffer_ebq_vals;
5669  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
5670  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
5671  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
5672  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
5673  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
5674  __Pyx_Buffer __pyx_pybuffer_x;
5675  PyObject *__pyx_r = NULL;
5676  __Pyx_RefNannyDeclarations
5677  npy_intp __pyx_t_1;
5678  int __pyx_t_2;
5679  npy_intp __pyx_t_3;
5680  int __pyx_t_4;
5681  Py_ssize_t __pyx_t_5;
5682  Py_ssize_t __pyx_t_6;
5683  int __pyx_t_7;
5684  Py_ssize_t __pyx_t_8;
5685  Py_ssize_t __pyx_t_9;
5686  Py_ssize_t __pyx_t_10;
5687  Py_ssize_t __pyx_t_11;
5688  npy_intp __pyx_t_12;
5689  PyObject *__pyx_t_13 = NULL;
5690  PyObject *__pyx_t_14 = NULL;
5691  PyObject *__pyx_t_15 = NULL;
5692  PyObject *__pyx_t_16 = NULL;
5693  PyObject *__pyx_t_17 = NULL;
5694  PyObject *__pyx_t_18 = NULL;
5695  int __pyx_t_19;
5696  PyObject *__pyx_t_20 = NULL;
5697  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_21;
5698  Py_ssize_t __pyx_t_22;
5699  Py_ssize_t __pyx_t_23;
5700  Py_ssize_t __pyx_t_24;
5701  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 0);
5702  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
5703  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
5704  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
5705  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
5706  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
5707  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
5708  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
5709  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
5710  __pyx_pybuffer_x.pybuffer.buf = NULL;
5711  __pyx_pybuffer_x.refcount = 0;
5712  __pyx_pybuffernd_x.data = NULL;
5713  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
5714  __pyx_pybuffer_ebq_vals.pybuffer.buf = NULL;
5715  __pyx_pybuffer_ebq_vals.refcount = 0;
5716  __pyx_pybuffernd_ebq_vals.data = NULL;
5717  __pyx_pybuffernd_ebq_vals.rcbuffer = &__pyx_pybuffer_ebq_vals;
5718  {
5719  __Pyx_BufFmt_StackElem __pyx_stack[1];
5720  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 195, __pyx_L1_error)
5721  }
5722  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
5723  {
5724  __Pyx_BufFmt_StackElem __pyx_stack[1];
5725  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 195, __pyx_L1_error)
5726  }
5727  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
5728  {
5729  __Pyx_BufFmt_StackElem __pyx_stack[1];
5730  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 195, __pyx_L1_error)
5731  }
5732  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
5733  {
5734  __Pyx_BufFmt_StackElem __pyx_stack[1];
5735  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 195, __pyx_L1_error)
5736  }
5737  __pyx_pybuffernd_ebq_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[2];
5738 
5739  /* "subsurfaceTransportFunctions.pyx":210
5740  * cdef int eN,ebN,ebN_local,k,material_left,material_right
5741  *
5742  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
5743  * for ebN_local in range(x.shape[1]):
5744  * ebN = elementBoundariesArray[eN,ebN_local]
5745  */
5746  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
5747  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
5748  __pyx_v_eN = __pyx_t_2;
5749 
5750  /* "subsurfaceTransportFunctions.pyx":211
5751  *
5752  * for eN in range(x.shape[0]):
5753  * for ebN_local in range(x.shape[1]): # <<<<<<<<<<<<<<
5754  * ebN = elementBoundariesArray[eN,ebN_local]
5755  * material_left = elementBoundaryTypes[ebN,0]
5756  */
5757  __pyx_t_3 = (__pyx_v_x->dimensions[1]);
5758  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
5759  __pyx_v_ebN_local = __pyx_t_4;
5760 
5761  /* "subsurfaceTransportFunctions.pyx":212
5762  * for eN in range(x.shape[0]):
5763  * for ebN_local in range(x.shape[1]):
5764  * ebN = elementBoundariesArray[eN,ebN_local] # <<<<<<<<<<<<<<
5765  * material_left = elementBoundaryTypes[ebN,0]
5766  * material_right= elementBoundaryTypes[ebN,1]
5767  */
5768  __pyx_t_5 = __pyx_v_eN;
5769  __pyx_t_6 = __pyx_v_ebN_local;
5770  __pyx_t_7 = -1;
5771  if (__pyx_t_5 < 0) {
5772  __pyx_t_5 += __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape;
5773  if (unlikely(__pyx_t_5 < 0)) __pyx_t_7 = 0;
5774  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape)) __pyx_t_7 = 0;
5775  if (__pyx_t_6 < 0) {
5776  __pyx_t_6 += __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape;
5777  if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 1;
5778  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape)) __pyx_t_7 = 1;
5779  if (unlikely(__pyx_t_7 != -1)) {
5780  __Pyx_RaiseBufferIndexError(__pyx_t_7);
5781  __PYX_ERR(0, 212, __pyx_L1_error)
5782  }
5783  __pyx_v_ebN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides));
5784 
5785  /* "subsurfaceTransportFunctions.pyx":213
5786  * for ebN_local in range(x.shape[1]):
5787  * ebN = elementBoundariesArray[eN,ebN_local]
5788  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
5789  * material_right= elementBoundaryTypes[ebN,1]
5790  * for k in range(x.shape[2]):
5791  */
5792  __pyx_t_8 = __pyx_v_ebN;
5793  __pyx_t_9 = 0;
5794  __pyx_t_7 = -1;
5795  if (__pyx_t_8 < 0) {
5796  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
5797  if (unlikely(__pyx_t_8 < 0)) __pyx_t_7 = 0;
5798  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_7 = 0;
5799  if (__pyx_t_9 < 0) {
5800  __pyx_t_9 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
5801  if (unlikely(__pyx_t_9 < 0)) __pyx_t_7 = 1;
5802  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_7 = 1;
5803  if (unlikely(__pyx_t_7 != -1)) {
5804  __Pyx_RaiseBufferIndexError(__pyx_t_7);
5805  __PYX_ERR(0, 213, __pyx_L1_error)
5806  }
5807  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
5808 
5809  /* "subsurfaceTransportFunctions.pyx":214
5810  * ebN = elementBoundariesArray[eN,ebN_local]
5811  * material_left = elementBoundaryTypes[ebN,0]
5812  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
5813  * for k in range(x.shape[2]):
5814  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+
5815  */
5816  __pyx_t_10 = __pyx_v_ebN;
5817  __pyx_t_11 = 1;
5818  __pyx_t_7 = -1;
5819  if (__pyx_t_10 < 0) {
5820  __pyx_t_10 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
5821  if (unlikely(__pyx_t_10 < 0)) __pyx_t_7 = 0;
5822  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_7 = 0;
5823  if (__pyx_t_11 < 0) {
5824  __pyx_t_11 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
5825  if (unlikely(__pyx_t_11 < 0)) __pyx_t_7 = 1;
5826  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_7 = 1;
5827  if (unlikely(__pyx_t_7 != -1)) {
5828  __Pyx_RaiseBufferIndexError(__pyx_t_7);
5829  __PYX_ERR(0, 214, __pyx_L1_error)
5830  }
5831  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
5832 
5833  /* "subsurfaceTransportFunctions.pyx":215
5834  * material_left = elementBoundaryTypes[ebN,0]
5835  * material_right= elementBoundaryTypes[ebN,1]
5836  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
5837  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+
5838  * material_functions[material_right](x[eN,ebN_local,k],t))
5839  */
5840  __pyx_t_12 = (__pyx_v_x->dimensions[2]);
5841  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_12; __pyx_t_7+=1) {
5842  __pyx_v_k = __pyx_t_7;
5843 
5844  /* "subsurfaceTransportFunctions.pyx":216
5845  * material_right= elementBoundaryTypes[ebN,1]
5846  * for k in range(x.shape[2]):
5847  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+ # <<<<<<<<<<<<<<
5848  * material_functions[material_right](x[eN,ebN_local,k],t))
5849  *
5850  */
5851  if (unlikely(__pyx_v_material_functions == Py_None)) {
5852  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5853  __PYX_ERR(0, 216, __pyx_L1_error)
5854  }
5855  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 216, __pyx_L1_error)
5856  __Pyx_GOTREF(__pyx_t_14);
5857  __pyx_t_15 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 216, __pyx_L1_error)
5858  __Pyx_GOTREF(__pyx_t_15);
5859  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
5860  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 216, __pyx_L1_error)
5861  __Pyx_GOTREF(__pyx_t_14);
5862  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 216, __pyx_L1_error)
5863  __Pyx_GOTREF(__pyx_t_16);
5864  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 216, __pyx_L1_error)
5865  __Pyx_GOTREF(__pyx_t_17);
5866  __pyx_t_18 = PyTuple_New(3); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 216, __pyx_L1_error)
5867  __Pyx_GOTREF(__pyx_t_18);
5868  __Pyx_GIVEREF(__pyx_t_14);
5869  PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_14);
5870  __Pyx_GIVEREF(__pyx_t_16);
5871  PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_16);
5872  __Pyx_GIVEREF(__pyx_t_17);
5873  PyTuple_SET_ITEM(__pyx_t_18, 2, __pyx_t_17);
5874  __pyx_t_14 = 0;
5875  __pyx_t_16 = 0;
5876  __pyx_t_17 = 0;
5877  __pyx_t_17 = PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_18); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 216, __pyx_L1_error)
5878  __Pyx_GOTREF(__pyx_t_17);
5879  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
5880  __pyx_t_18 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 216, __pyx_L1_error)
5881  __Pyx_GOTREF(__pyx_t_18);
5882  __pyx_t_16 = NULL;
5883  __pyx_t_19 = 0;
5884  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_15))) {
5885  __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_15);
5886  if (likely(__pyx_t_16)) {
5887  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
5888  __Pyx_INCREF(__pyx_t_16);
5889  __Pyx_INCREF(function);
5890  __Pyx_DECREF_SET(__pyx_t_15, function);
5891  __pyx_t_19 = 1;
5892  }
5893  }
5894  #if CYTHON_FAST_PYCALL
5895  if (PyFunction_Check(__pyx_t_15)) {
5896  PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_17, __pyx_t_18};
5897  __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_15, __pyx_temp+1-__pyx_t_19, 2+__pyx_t_19); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 216, __pyx_L1_error)
5898  __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
5899  __Pyx_GOTREF(__pyx_t_13);
5900  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
5901  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
5902  } else
5903  #endif
5904  #if CYTHON_FAST_PYCCALL
5905  if (__Pyx_PyFastCFunction_Check(__pyx_t_15)) {
5906  PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_17, __pyx_t_18};
5907  __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_15, __pyx_temp+1-__pyx_t_19, 2+__pyx_t_19); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 216, __pyx_L1_error)
5908  __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
5909  __Pyx_GOTREF(__pyx_t_13);
5910  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
5911  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
5912  } else
5913  #endif
5914  {
5915  __pyx_t_14 = PyTuple_New(2+__pyx_t_19); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 216, __pyx_L1_error)
5916  __Pyx_GOTREF(__pyx_t_14);
5917  if (__pyx_t_16) {
5918  __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_16); __pyx_t_16 = NULL;
5919  }
5920  __Pyx_GIVEREF(__pyx_t_17);
5921  PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_19, __pyx_t_17);
5922  __Pyx_GIVEREF(__pyx_t_18);
5923  PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_19, __pyx_t_18);
5924  __pyx_t_17 = 0;
5925  __pyx_t_18 = 0;
5926  __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_14, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 216, __pyx_L1_error)
5927  __Pyx_GOTREF(__pyx_t_13);
5928  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
5929  }
5930  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
5931 
5932  /* "subsurfaceTransportFunctions.pyx":217
5933  * for k in range(x.shape[2]):
5934  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+
5935  * material_functions[material_right](x[eN,ebN_local,k],t)) # <<<<<<<<<<<<<<
5936  *
5937  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd,
5938  */
5939  if (unlikely(__pyx_v_material_functions == Py_None)) {
5940  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5941  __PYX_ERR(0, 217, __pyx_L1_error)
5942  }
5943  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 217, __pyx_L1_error)
5944  __Pyx_GOTREF(__pyx_t_14);
5945  __pyx_t_18 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_14); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 217, __pyx_L1_error)
5946  __Pyx_GOTREF(__pyx_t_18);
5947  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
5948  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 217, __pyx_L1_error)
5949  __Pyx_GOTREF(__pyx_t_14);
5950  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 217, __pyx_L1_error)
5951  __Pyx_GOTREF(__pyx_t_17);
5952  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 217, __pyx_L1_error)
5953  __Pyx_GOTREF(__pyx_t_16);
5954  __pyx_t_20 = PyTuple_New(3); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 217, __pyx_L1_error)
5955  __Pyx_GOTREF(__pyx_t_20);
5956  __Pyx_GIVEREF(__pyx_t_14);
5957  PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_14);
5958  __Pyx_GIVEREF(__pyx_t_17);
5959  PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_17);
5960  __Pyx_GIVEREF(__pyx_t_16);
5961  PyTuple_SET_ITEM(__pyx_t_20, 2, __pyx_t_16);
5962  __pyx_t_14 = 0;
5963  __pyx_t_17 = 0;
5964  __pyx_t_16 = 0;
5965  __pyx_t_16 = PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_20); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 217, __pyx_L1_error)
5966  __Pyx_GOTREF(__pyx_t_16);
5967  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
5968  __pyx_t_20 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 217, __pyx_L1_error)
5969  __Pyx_GOTREF(__pyx_t_20);
5970  __pyx_t_17 = NULL;
5971  __pyx_t_19 = 0;
5972  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_18))) {
5973  __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_18);
5974  if (likely(__pyx_t_17)) {
5975  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18);
5976  __Pyx_INCREF(__pyx_t_17);
5977  __Pyx_INCREF(function);
5978  __Pyx_DECREF_SET(__pyx_t_18, function);
5979  __pyx_t_19 = 1;
5980  }
5981  }
5982  #if CYTHON_FAST_PYCALL
5983  if (PyFunction_Check(__pyx_t_18)) {
5984  PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_t_16, __pyx_t_20};
5985  __pyx_t_15 = __Pyx_PyFunction_FastCall(__pyx_t_18, __pyx_temp+1-__pyx_t_19, 2+__pyx_t_19); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 217, __pyx_L1_error)
5986  __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
5987  __Pyx_GOTREF(__pyx_t_15);
5988  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
5989  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
5990  } else
5991  #endif
5992  #if CYTHON_FAST_PYCCALL
5993  if (__Pyx_PyFastCFunction_Check(__pyx_t_18)) {
5994  PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_t_16, __pyx_t_20};
5995  __pyx_t_15 = __Pyx_PyCFunction_FastCall(__pyx_t_18, __pyx_temp+1-__pyx_t_19, 2+__pyx_t_19); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 217, __pyx_L1_error)
5996  __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
5997  __Pyx_GOTREF(__pyx_t_15);
5998  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
5999  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
6000  } else
6001  #endif
6002  {
6003  __pyx_t_14 = PyTuple_New(2+__pyx_t_19); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 217, __pyx_L1_error)
6004  __Pyx_GOTREF(__pyx_t_14);
6005  if (__pyx_t_17) {
6006  __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_17); __pyx_t_17 = NULL;
6007  }
6008  __Pyx_GIVEREF(__pyx_t_16);
6009  PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_19, __pyx_t_16);
6010  __Pyx_GIVEREF(__pyx_t_20);
6011  PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_19, __pyx_t_20);
6012  __pyx_t_16 = 0;
6013  __pyx_t_20 = 0;
6014  __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_18, __pyx_t_14, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 217, __pyx_L1_error)
6015  __Pyx_GOTREF(__pyx_t_15);
6016  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
6017  }
6018  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
6019 
6020  /* "subsurfaceTransportFunctions.pyx":216
6021  * material_right= elementBoundaryTypes[ebN,1]
6022  * for k in range(x.shape[2]):
6023  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+ # <<<<<<<<<<<<<<
6024  * material_functions[material_right](x[eN,ebN_local,k],t))
6025  *
6026  */
6027  __pyx_t_18 = PyNumber_Add(__pyx_t_13, __pyx_t_15); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 216, __pyx_L1_error)
6028  __Pyx_GOTREF(__pyx_t_18);
6029  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
6030  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
6031  __pyx_t_15 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_18); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 216, __pyx_L1_error)
6032  __Pyx_GOTREF(__pyx_t_15);
6033  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
6034  __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_15); if (unlikely((__pyx_t_21 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L1_error)
6035  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
6036  __pyx_t_22 = __pyx_v_eN;
6037  __pyx_t_23 = __pyx_v_ebN_local;
6038  __pyx_t_24 = __pyx_v_k;
6039  __pyx_t_19 = -1;
6040  if (__pyx_t_22 < 0) {
6041  __pyx_t_22 += __pyx_pybuffernd_ebq_vals.diminfo[0].shape;
6042  if (unlikely(__pyx_t_22 < 0)) __pyx_t_19 = 0;
6043  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_ebq_vals.diminfo[0].shape)) __pyx_t_19 = 0;
6044  if (__pyx_t_23 < 0) {
6045  __pyx_t_23 += __pyx_pybuffernd_ebq_vals.diminfo[1].shape;
6046  if (unlikely(__pyx_t_23 < 0)) __pyx_t_19 = 1;
6047  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_ebq_vals.diminfo[1].shape)) __pyx_t_19 = 1;
6048  if (__pyx_t_24 < 0) {
6049  __pyx_t_24 += __pyx_pybuffernd_ebq_vals.diminfo[2].shape;
6050  if (unlikely(__pyx_t_24 < 0)) __pyx_t_19 = 2;
6051  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_ebq_vals.diminfo[2].shape)) __pyx_t_19 = 2;
6052  if (unlikely(__pyx_t_19 != -1)) {
6053  __Pyx_RaiseBufferIndexError(__pyx_t_19);
6054  __PYX_ERR(0, 216, __pyx_L1_error)
6055  }
6056  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_ebq_vals.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_ebq_vals.diminfo[1].strides, __pyx_t_24, __pyx_pybuffernd_ebq_vals.diminfo[2].strides) = __pyx_t_21;
6057  }
6058  }
6059  }
6060 
6061  /* "subsurfaceTransportFunctions.pyx":195
6062  *
6063  *
6064  * def evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
6065  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
6066  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
6067  */
6068 
6069  /* function exit code */
6070  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6071  goto __pyx_L0;
6072  __pyx_L1_error:;
6073  __Pyx_XDECREF(__pyx_t_13);
6074  __Pyx_XDECREF(__pyx_t_14);
6075  __Pyx_XDECREF(__pyx_t_15);
6076  __Pyx_XDECREF(__pyx_t_16);
6077  __Pyx_XDECREF(__pyx_t_17);
6078  __Pyx_XDECREF(__pyx_t_18);
6079  __Pyx_XDECREF(__pyx_t_20);
6080  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
6081  __Pyx_PyThreadState_declare
6082  __Pyx_PyThreadState_assign
6083  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
6084  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
6085  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
6086  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
6087  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
6088  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
6089  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
6090  __pyx_r = NULL;
6091  goto __pyx_L2;
6092  __pyx_L0:;
6093  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
6094  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
6095  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
6096  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
6097  __pyx_L2:;
6098  __Pyx_XGIVEREF(__pyx_r);
6099  __Pyx_RefNannyFinishContext();
6100  return __pyx_r;
6101 }
6102 
6103 /* "subsurfaceTransportFunctions.pyx":219
6104  * material_functions[material_right](x[eN,ebN_local,k],t))
6105  *
6106  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
6107  * double t,
6108  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
6109  */
6110 
6111 /* Python wrapper */
6112 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6113 static char __pyx_doc_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage[] = "\n loop over quadrature array and evaluate function \ten f_{mn}(x,t) = f^L_{j,mn}(x,t)f^R_{k,mn}(x,t)/(f^L_{j,mn}(x,t)+f^R_{k,mn})\n assuming element on left is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
6114 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage = {"evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage};
6115 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6116  int __pyx_v_nd;
6117  double __pyx_v_t;
6118  PyArrayObject *__pyx_v_elementBoundariesArray = 0;
6119  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
6120  PyArrayObject *__pyx_v_x = 0;
6121  PyArrayObject *__pyx_v_ebq_vals = 0;
6122  PyObject *__pyx_v_material_functions = 0;
6123  PyObject *__pyx_r = 0;
6124  __Pyx_RefNannyDeclarations
6125  __Pyx_RefNannySetupContext("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage (wrapper)", 0);
6126  {
6127  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nd,&__pyx_n_s_t,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_x,&__pyx_n_s_ebq_vals,&__pyx_n_s_material_functions,0};
6128  PyObject* values[7] = {0,0,0,0,0,0,0};
6129  if (unlikely(__pyx_kwds)) {
6130  Py_ssize_t kw_args;
6131  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6132  switch (pos_args) {
6133  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
6134  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6135  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6136  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6137  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6138  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6139  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6140  case 0: break;
6141  default: goto __pyx_L5_argtuple_error;
6142  }
6143  kw_args = PyDict_Size(__pyx_kwds);
6144  switch (pos_args) {
6145  case 0:
6146  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
6147  else goto __pyx_L5_argtuple_error;
6148  case 1:
6149  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
6150  else {
6151  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 1); __PYX_ERR(0, 219, __pyx_L3_error)
6152  }
6153  case 2:
6154  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
6155  else {
6156  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 2); __PYX_ERR(0, 219, __pyx_L3_error)
6157  }
6158  case 3:
6159  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
6160  else {
6161  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 3); __PYX_ERR(0, 219, __pyx_L3_error)
6162  }
6163  case 4:
6164  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
6165  else {
6166  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 4); __PYX_ERR(0, 219, __pyx_L3_error)
6167  }
6168  case 5:
6169  if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ebq_vals)) != 0)) kw_args--;
6170  else {
6171  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 5); __PYX_ERR(0, 219, __pyx_L3_error)
6172  }
6173  case 6:
6174  if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
6175  else {
6176  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 6); __PYX_ERR(0, 219, __pyx_L3_error)
6177  }
6178  }
6179  if (unlikely(kw_args > 0)) {
6180  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage") < 0)) __PYX_ERR(0, 219, __pyx_L3_error)
6181  }
6182  } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
6183  goto __pyx_L5_argtuple_error;
6184  } else {
6185  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6186  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6187  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6188  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6189  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6190  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6191  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
6192  }
6193  __pyx_v_nd = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 219, __pyx_L3_error)
6194  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L3_error)
6195  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[2]);
6196  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[3]);
6197  __pyx_v_x = ((PyArrayObject *)values[4]);
6198  __pyx_v_ebq_vals = ((PyArrayObject *)values[5]);
6199  __pyx_v_material_functions = ((PyObject*)values[6]);
6200  }
6201  goto __pyx_L4_argument_unpacking_done;
6202  __pyx_L5_argtuple_error:;
6203  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 219, __pyx_L3_error)
6204  __pyx_L3_error:;
6205  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
6206  __Pyx_RefNannyFinishContext();
6207  return NULL;
6208  __pyx_L4_argument_unpacking_done:;
6209  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 221, __pyx_L1_error)
6210  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 222, __pyx_L1_error)
6211  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 223, __pyx_L1_error)
6212  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_vals", 0))) __PYX_ERR(0, 224, __pyx_L1_error)
6213  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 225, __pyx_L1_error)
6214  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(__pyx_self, __pyx_v_nd, __pyx_v_t, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_x, __pyx_v_ebq_vals, __pyx_v_material_functions);
6215 
6216  /* function exit code */
6217  goto __pyx_L0;
6218  __pyx_L1_error:;
6219  __pyx_r = NULL;
6220  __pyx_L0:;
6221  __Pyx_RefNannyFinishContext();
6222  return __pyx_r;
6223 }
6224 
6225 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, double __pyx_v_t, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions) {
6226  int __pyx_v_eN;
6227  int __pyx_v_ebN;
6228  int __pyx_v_ebN_local;
6229  int __pyx_v_k;
6230  int __pyx_v_material_left;
6231  int __pyx_v_material_right;
6232  int __pyx_v_I;
6233  int __pyx_v_J;
6234  double __pyx_v_numer;
6235  double __pyx_v_denom;
6236  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_vals;
6237  __Pyx_Buffer __pyx_pybuffer_ebq_vals;
6238  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
6239  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
6240  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
6241  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
6242  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
6243  __Pyx_Buffer __pyx_pybuffer_x;
6244  PyObject *__pyx_r = NULL;
6245  __Pyx_RefNannyDeclarations
6246  npy_intp __pyx_t_1;
6247  int __pyx_t_2;
6248  npy_intp __pyx_t_3;
6249  int __pyx_t_4;
6250  Py_ssize_t __pyx_t_5;
6251  Py_ssize_t __pyx_t_6;
6252  int __pyx_t_7;
6253  Py_ssize_t __pyx_t_8;
6254  Py_ssize_t __pyx_t_9;
6255  Py_ssize_t __pyx_t_10;
6256  Py_ssize_t __pyx_t_11;
6257  npy_intp __pyx_t_12;
6258  int __pyx_t_13;
6259  int __pyx_t_14;
6260  int __pyx_t_15;
6261  int __pyx_t_16;
6262  PyObject *__pyx_t_17 = NULL;
6263  PyObject *__pyx_t_18 = NULL;
6264  PyObject *__pyx_t_19 = NULL;
6265  PyObject *__pyx_t_20 = NULL;
6266  PyObject *__pyx_t_21 = NULL;
6267  PyObject *__pyx_t_22 = NULL;
6268  int __pyx_t_23;
6269  PyObject *__pyx_t_24 = NULL;
6270  double __pyx_t_25;
6271  Py_ssize_t __pyx_t_26;
6272  Py_ssize_t __pyx_t_27;
6273  Py_ssize_t __pyx_t_28;
6274  Py_ssize_t __pyx_t_29;
6275  __Pyx_RefNannySetupContext("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 0);
6276  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
6277  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
6278  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
6279  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
6280  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
6281  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
6282  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
6283  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
6284  __pyx_pybuffer_x.pybuffer.buf = NULL;
6285  __pyx_pybuffer_x.refcount = 0;
6286  __pyx_pybuffernd_x.data = NULL;
6287  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
6288  __pyx_pybuffer_ebq_vals.pybuffer.buf = NULL;
6289  __pyx_pybuffer_ebq_vals.refcount = 0;
6290  __pyx_pybuffernd_ebq_vals.data = NULL;
6291  __pyx_pybuffernd_ebq_vals.rcbuffer = &__pyx_pybuffer_ebq_vals;
6292  {
6293  __Pyx_BufFmt_StackElem __pyx_stack[1];
6294  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 219, __pyx_L1_error)
6295  }
6296  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
6297  {
6298  __Pyx_BufFmt_StackElem __pyx_stack[1];
6299  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 219, __pyx_L1_error)
6300  }
6301  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
6302  {
6303  __Pyx_BufFmt_StackElem __pyx_stack[1];
6304  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 219, __pyx_L1_error)
6305  }
6306  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
6307  {
6308  __Pyx_BufFmt_StackElem __pyx_stack[1];
6309  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 219, __pyx_L1_error)
6310  }
6311  __pyx_pybuffernd_ebq_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_ebq_vals.diminfo[3].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_ebq_vals.diminfo[3].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[3];
6312 
6313  /* "subsurfaceTransportFunctions.pyx":236
6314  * cdef double numer,denom
6315  *
6316  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
6317  * for ebN_local in range(x.shape[1]):
6318  * ebN = elementBoundariesArray[eN,ebN_local]
6319  */
6320  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
6321  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
6322  __pyx_v_eN = __pyx_t_2;
6323 
6324  /* "subsurfaceTransportFunctions.pyx":237
6325  *
6326  * for eN in range(x.shape[0]):
6327  * for ebN_local in range(x.shape[1]): # <<<<<<<<<<<<<<
6328  * ebN = elementBoundariesArray[eN,ebN_local]
6329  * material_left = elementBoundaryTypes[ebN,0]
6330  */
6331  __pyx_t_3 = (__pyx_v_x->dimensions[1]);
6332  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
6333  __pyx_v_ebN_local = __pyx_t_4;
6334 
6335  /* "subsurfaceTransportFunctions.pyx":238
6336  * for eN in range(x.shape[0]):
6337  * for ebN_local in range(x.shape[1]):
6338  * ebN = elementBoundariesArray[eN,ebN_local] # <<<<<<<<<<<<<<
6339  * material_left = elementBoundaryTypes[ebN,0]
6340  * material_right= elementBoundaryTypes[ebN,1]
6341  */
6342  __pyx_t_5 = __pyx_v_eN;
6343  __pyx_t_6 = __pyx_v_ebN_local;
6344  __pyx_t_7 = -1;
6345  if (__pyx_t_5 < 0) {
6346  __pyx_t_5 += __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape;
6347  if (unlikely(__pyx_t_5 < 0)) __pyx_t_7 = 0;
6348  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape)) __pyx_t_7 = 0;
6349  if (__pyx_t_6 < 0) {
6350  __pyx_t_6 += __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape;
6351  if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 1;
6352  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape)) __pyx_t_7 = 1;
6353  if (unlikely(__pyx_t_7 != -1)) {
6354  __Pyx_RaiseBufferIndexError(__pyx_t_7);
6355  __PYX_ERR(0, 238, __pyx_L1_error)
6356  }
6357  __pyx_v_ebN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides));
6358 
6359  /* "subsurfaceTransportFunctions.pyx":239
6360  * for ebN_local in range(x.shape[1]):
6361  * ebN = elementBoundariesArray[eN,ebN_local]
6362  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
6363  * material_right= elementBoundaryTypes[ebN,1]
6364  * for k in range(x.shape[2]):
6365  */
6366  __pyx_t_8 = __pyx_v_ebN;
6367  __pyx_t_9 = 0;
6368  __pyx_t_7 = -1;
6369  if (__pyx_t_8 < 0) {
6370  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
6371  if (unlikely(__pyx_t_8 < 0)) __pyx_t_7 = 0;
6372  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_7 = 0;
6373  if (__pyx_t_9 < 0) {
6374  __pyx_t_9 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
6375  if (unlikely(__pyx_t_9 < 0)) __pyx_t_7 = 1;
6376  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_7 = 1;
6377  if (unlikely(__pyx_t_7 != -1)) {
6378  __Pyx_RaiseBufferIndexError(__pyx_t_7);
6379  __PYX_ERR(0, 239, __pyx_L1_error)
6380  }
6381  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
6382 
6383  /* "subsurfaceTransportFunctions.pyx":240
6384  * ebN = elementBoundariesArray[eN,ebN_local]
6385  * material_left = elementBoundaryTypes[ebN,0]
6386  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
6387  * for k in range(x.shape[2]):
6388  * for I in range(nd):
6389  */
6390  __pyx_t_10 = __pyx_v_ebN;
6391  __pyx_t_11 = 1;
6392  __pyx_t_7 = -1;
6393  if (__pyx_t_10 < 0) {
6394  __pyx_t_10 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
6395  if (unlikely(__pyx_t_10 < 0)) __pyx_t_7 = 0;
6396  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_7 = 0;
6397  if (__pyx_t_11 < 0) {
6398  __pyx_t_11 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
6399  if (unlikely(__pyx_t_11 < 0)) __pyx_t_7 = 1;
6400  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_7 = 1;
6401  if (unlikely(__pyx_t_7 != -1)) {
6402  __Pyx_RaiseBufferIndexError(__pyx_t_7);
6403  __PYX_ERR(0, 240, __pyx_L1_error)
6404  }
6405  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
6406 
6407  /* "subsurfaceTransportFunctions.pyx":241
6408  * material_left = elementBoundaryTypes[ebN,0]
6409  * material_right= elementBoundaryTypes[ebN,1]
6410  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
6411  * for I in range(nd):
6412  * for J in range(nd):
6413  */
6414  __pyx_t_12 = (__pyx_v_x->dimensions[2]);
6415  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_12; __pyx_t_7+=1) {
6416  __pyx_v_k = __pyx_t_7;
6417 
6418  /* "subsurfaceTransportFunctions.pyx":242
6419  * material_right= elementBoundaryTypes[ebN,1]
6420  * for k in range(x.shape[2]):
6421  * for I in range(nd): # <<<<<<<<<<<<<<
6422  * for J in range(nd):
6423  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J]
6424  */
6425  __pyx_t_13 = __pyx_v_nd;
6426  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
6427  __pyx_v_I = __pyx_t_14;
6428 
6429  /* "subsurfaceTransportFunctions.pyx":243
6430  * for k in range(x.shape[2]):
6431  * for I in range(nd):
6432  * for J in range(nd): # <<<<<<<<<<<<<<
6433  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J]
6434  * denom = material_functions[material_left](x[eN,ebN_local,k],t)[I,J] + material_functions[material_right](x[eN,ebN_local,k],t)[I,J] + 1.0e-20
6435  */
6436  __pyx_t_15 = __pyx_v_nd;
6437  for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
6438  __pyx_v_J = __pyx_t_16;
6439 
6440  /* "subsurfaceTransportFunctions.pyx":244
6441  * for I in range(nd):
6442  * for J in range(nd):
6443  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J] # <<<<<<<<<<<<<<
6444  * denom = material_functions[material_left](x[eN,ebN_local,k],t)[I,J] + material_functions[material_right](x[eN,ebN_local,k],t)[I,J] + 1.0e-20
6445  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
6446  */
6447  if (unlikely(__pyx_v_material_functions == Py_None)) {
6448  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6449  __PYX_ERR(0, 244, __pyx_L1_error)
6450  }
6451  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
6452  __Pyx_GOTREF(__pyx_t_18);
6453  __pyx_t_19 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_18); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 244, __pyx_L1_error)
6454  __Pyx_GOTREF(__pyx_t_19);
6455  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
6456  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
6457  __Pyx_GOTREF(__pyx_t_18);
6458  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 244, __pyx_L1_error)
6459  __Pyx_GOTREF(__pyx_t_20);
6460  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 244, __pyx_L1_error)
6461  __Pyx_GOTREF(__pyx_t_21);
6462  __pyx_t_22 = PyTuple_New(3); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
6463  __Pyx_GOTREF(__pyx_t_22);
6464  __Pyx_GIVEREF(__pyx_t_18);
6465  PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_18);
6466  __Pyx_GIVEREF(__pyx_t_20);
6467  PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_20);
6468  __Pyx_GIVEREF(__pyx_t_21);
6469  PyTuple_SET_ITEM(__pyx_t_22, 2, __pyx_t_21);
6470  __pyx_t_18 = 0;
6471  __pyx_t_20 = 0;
6472  __pyx_t_21 = 0;
6473  __pyx_t_21 = PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_22); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 244, __pyx_L1_error)
6474  __Pyx_GOTREF(__pyx_t_21);
6475  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
6476  __pyx_t_22 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
6477  __Pyx_GOTREF(__pyx_t_22);
6478  __pyx_t_20 = NULL;
6479  __pyx_t_23 = 0;
6480  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_19))) {
6481  __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_19);
6482  if (likely(__pyx_t_20)) {
6483  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19);
6484  __Pyx_INCREF(__pyx_t_20);
6485  __Pyx_INCREF(function);
6486  __Pyx_DECREF_SET(__pyx_t_19, function);
6487  __pyx_t_23 = 1;
6488  }
6489  }
6490  #if CYTHON_FAST_PYCALL
6491  if (PyFunction_Check(__pyx_t_19)) {
6492  PyObject *__pyx_temp[3] = {__pyx_t_20, __pyx_t_21, __pyx_t_22};
6493  __pyx_t_17 = __Pyx_PyFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_23, 2+__pyx_t_23); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 244, __pyx_L1_error)
6494  __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
6495  __Pyx_GOTREF(__pyx_t_17);
6496  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6497  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
6498  } else
6499  #endif
6500  #if CYTHON_FAST_PYCCALL
6501  if (__Pyx_PyFastCFunction_Check(__pyx_t_19)) {
6502  PyObject *__pyx_temp[3] = {__pyx_t_20, __pyx_t_21, __pyx_t_22};
6503  __pyx_t_17 = __Pyx_PyCFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_23, 2+__pyx_t_23); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 244, __pyx_L1_error)
6504  __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
6505  __Pyx_GOTREF(__pyx_t_17);
6506  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6507  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
6508  } else
6509  #endif
6510  {
6511  __pyx_t_18 = PyTuple_New(2+__pyx_t_23); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
6512  __Pyx_GOTREF(__pyx_t_18);
6513  if (__pyx_t_20) {
6514  __Pyx_GIVEREF(__pyx_t_20); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_20); __pyx_t_20 = NULL;
6515  }
6516  __Pyx_GIVEREF(__pyx_t_21);
6517  PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_23, __pyx_t_21);
6518  __Pyx_GIVEREF(__pyx_t_22);
6519  PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_23, __pyx_t_22);
6520  __pyx_t_21 = 0;
6521  __pyx_t_22 = 0;
6522  __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_18, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 244, __pyx_L1_error)
6523  __Pyx_GOTREF(__pyx_t_17);
6524  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
6525  }
6526  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
6527  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 244, __pyx_L1_error)
6528  __Pyx_GOTREF(__pyx_t_19);
6529  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
6530  __Pyx_GOTREF(__pyx_t_18);
6531  __pyx_t_22 = PyTuple_New(2); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
6532  __Pyx_GOTREF(__pyx_t_22);
6533  __Pyx_GIVEREF(__pyx_t_19);
6534  PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_19);
6535  __Pyx_GIVEREF(__pyx_t_18);
6536  PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_18);
6537  __pyx_t_19 = 0;
6538  __pyx_t_18 = 0;
6539  __pyx_t_18 = PyObject_GetItem(__pyx_t_17, __pyx_t_22); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
6540  __Pyx_GOTREF(__pyx_t_18);
6541  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6542  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
6543  __pyx_t_22 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_18); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
6544  __Pyx_GOTREF(__pyx_t_22);
6545  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
6546  if (unlikely(__pyx_v_material_functions == Py_None)) {
6547  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6548  __PYX_ERR(0, 244, __pyx_L1_error)
6549  }
6550  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 244, __pyx_L1_error)
6551  __Pyx_GOTREF(__pyx_t_17);
6552  __pyx_t_19 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_17); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 244, __pyx_L1_error)
6553  __Pyx_GOTREF(__pyx_t_19);
6554  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6555  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 244, __pyx_L1_error)
6556  __Pyx_GOTREF(__pyx_t_17);
6557  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 244, __pyx_L1_error)
6558  __Pyx_GOTREF(__pyx_t_21);
6559  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 244, __pyx_L1_error)
6560  __Pyx_GOTREF(__pyx_t_20);
6561  __pyx_t_24 = PyTuple_New(3); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 244, __pyx_L1_error)
6562  __Pyx_GOTREF(__pyx_t_24);
6563  __Pyx_GIVEREF(__pyx_t_17);
6564  PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_17);
6565  __Pyx_GIVEREF(__pyx_t_21);
6566  PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_21);
6567  __Pyx_GIVEREF(__pyx_t_20);
6568  PyTuple_SET_ITEM(__pyx_t_24, 2, __pyx_t_20);
6569  __pyx_t_17 = 0;
6570  __pyx_t_21 = 0;
6571  __pyx_t_20 = 0;
6572  __pyx_t_20 = PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_24); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 244, __pyx_L1_error)
6573  __Pyx_GOTREF(__pyx_t_20);
6574  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
6575  __pyx_t_24 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 244, __pyx_L1_error)
6576  __Pyx_GOTREF(__pyx_t_24);
6577  __pyx_t_21 = NULL;
6578  __pyx_t_23 = 0;
6579  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_19))) {
6580  __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_19);
6581  if (likely(__pyx_t_21)) {
6582  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19);
6583  __Pyx_INCREF(__pyx_t_21);
6584  __Pyx_INCREF(function);
6585  __Pyx_DECREF_SET(__pyx_t_19, function);
6586  __pyx_t_23 = 1;
6587  }
6588  }
6589  #if CYTHON_FAST_PYCALL
6590  if (PyFunction_Check(__pyx_t_19)) {
6591  PyObject *__pyx_temp[3] = {__pyx_t_21, __pyx_t_20, __pyx_t_24};
6592  __pyx_t_18 = __Pyx_PyFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_23, 2+__pyx_t_23); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
6593  __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
6594  __Pyx_GOTREF(__pyx_t_18);
6595  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
6596  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
6597  } else
6598  #endif
6599  #if CYTHON_FAST_PYCCALL
6600  if (__Pyx_PyFastCFunction_Check(__pyx_t_19)) {
6601  PyObject *__pyx_temp[3] = {__pyx_t_21, __pyx_t_20, __pyx_t_24};
6602  __pyx_t_18 = __Pyx_PyCFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_23, 2+__pyx_t_23); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
6603  __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
6604  __Pyx_GOTREF(__pyx_t_18);
6605  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
6606  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
6607  } else
6608  #endif
6609  {
6610  __pyx_t_17 = PyTuple_New(2+__pyx_t_23); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 244, __pyx_L1_error)
6611  __Pyx_GOTREF(__pyx_t_17);
6612  if (__pyx_t_21) {
6613  __Pyx_GIVEREF(__pyx_t_21); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_21); __pyx_t_21 = NULL;
6614  }
6615  __Pyx_GIVEREF(__pyx_t_20);
6616  PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_23, __pyx_t_20);
6617  __Pyx_GIVEREF(__pyx_t_24);
6618  PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_23, __pyx_t_24);
6619  __pyx_t_20 = 0;
6620  __pyx_t_24 = 0;
6621  __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_17, NULL); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
6622  __Pyx_GOTREF(__pyx_t_18);
6623  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6624  }
6625  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
6626  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 244, __pyx_L1_error)
6627  __Pyx_GOTREF(__pyx_t_19);
6628  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 244, __pyx_L1_error)
6629  __Pyx_GOTREF(__pyx_t_17);
6630  __pyx_t_24 = PyTuple_New(2); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 244, __pyx_L1_error)
6631  __Pyx_GOTREF(__pyx_t_24);
6632  __Pyx_GIVEREF(__pyx_t_19);
6633  PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_19);
6634  __Pyx_GIVEREF(__pyx_t_17);
6635  PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_17);
6636  __pyx_t_19 = 0;
6637  __pyx_t_17 = 0;
6638  __pyx_t_17 = PyObject_GetItem(__pyx_t_18, __pyx_t_24); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 244, __pyx_L1_error)
6639  __Pyx_GOTREF(__pyx_t_17);
6640  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
6641  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
6642  __pyx_t_24 = PyNumber_Multiply(__pyx_t_22, __pyx_t_17); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 244, __pyx_L1_error)
6643  __Pyx_GOTREF(__pyx_t_24);
6644  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
6645  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6646  __pyx_t_25 = __pyx_PyFloat_AsDouble(__pyx_t_24); if (unlikely((__pyx_t_25 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 244, __pyx_L1_error)
6647  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
6648  __pyx_v_numer = __pyx_t_25;
6649 
6650  /* "subsurfaceTransportFunctions.pyx":245
6651  * for J in range(nd):
6652  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J]
6653  * denom = material_functions[material_left](x[eN,ebN_local,k],t)[I,J] + material_functions[material_right](x[eN,ebN_local,k],t)[I,J] + 1.0e-20 # <<<<<<<<<<<<<<
6654  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
6655  *
6656  */
6657  if (unlikely(__pyx_v_material_functions == Py_None)) {
6658  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6659  __PYX_ERR(0, 245, __pyx_L1_error)
6660  }
6661  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 245, __pyx_L1_error)
6662  __Pyx_GOTREF(__pyx_t_17);
6663  __pyx_t_22 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_17); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 245, __pyx_L1_error)
6664  __Pyx_GOTREF(__pyx_t_22);
6665  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6666  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 245, __pyx_L1_error)
6667  __Pyx_GOTREF(__pyx_t_17);
6668  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 245, __pyx_L1_error)
6669  __Pyx_GOTREF(__pyx_t_18);
6670  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 245, __pyx_L1_error)
6671  __Pyx_GOTREF(__pyx_t_19);
6672  __pyx_t_20 = PyTuple_New(3); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 245, __pyx_L1_error)
6673  __Pyx_GOTREF(__pyx_t_20);
6674  __Pyx_GIVEREF(__pyx_t_17);
6675  PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_17);
6676  __Pyx_GIVEREF(__pyx_t_18);
6677  PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_18);
6678  __Pyx_GIVEREF(__pyx_t_19);
6679  PyTuple_SET_ITEM(__pyx_t_20, 2, __pyx_t_19);
6680  __pyx_t_17 = 0;
6681  __pyx_t_18 = 0;
6682  __pyx_t_19 = 0;
6683  __pyx_t_19 = PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_20); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 245, __pyx_L1_error)
6684  __Pyx_GOTREF(__pyx_t_19);
6685  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
6686  __pyx_t_20 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 245, __pyx_L1_error)
6687  __Pyx_GOTREF(__pyx_t_20);
6688  __pyx_t_18 = NULL;
6689  __pyx_t_23 = 0;
6690  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_22))) {
6691  __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_22);
6692  if (likely(__pyx_t_18)) {
6693  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_22);
6694  __Pyx_INCREF(__pyx_t_18);
6695  __Pyx_INCREF(function);
6696  __Pyx_DECREF_SET(__pyx_t_22, function);
6697  __pyx_t_23 = 1;
6698  }
6699  }
6700  #if CYTHON_FAST_PYCALL
6701  if (PyFunction_Check(__pyx_t_22)) {
6702  PyObject *__pyx_temp[3] = {__pyx_t_18, __pyx_t_19, __pyx_t_20};
6703  __pyx_t_24 = __Pyx_PyFunction_FastCall(__pyx_t_22, __pyx_temp+1-__pyx_t_23, 2+__pyx_t_23); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 245, __pyx_L1_error)
6704  __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
6705  __Pyx_GOTREF(__pyx_t_24);
6706  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
6707  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
6708  } else
6709  #endif
6710  #if CYTHON_FAST_PYCCALL
6711  if (__Pyx_PyFastCFunction_Check(__pyx_t_22)) {
6712  PyObject *__pyx_temp[3] = {__pyx_t_18, __pyx_t_19, __pyx_t_20};
6713  __pyx_t_24 = __Pyx_PyCFunction_FastCall(__pyx_t_22, __pyx_temp+1-__pyx_t_23, 2+__pyx_t_23); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 245, __pyx_L1_error)
6714  __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
6715  __Pyx_GOTREF(__pyx_t_24);
6716  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
6717  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
6718  } else
6719  #endif
6720  {
6721  __pyx_t_17 = PyTuple_New(2+__pyx_t_23); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 245, __pyx_L1_error)
6722  __Pyx_GOTREF(__pyx_t_17);
6723  if (__pyx_t_18) {
6724  __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_18); __pyx_t_18 = NULL;
6725  }
6726  __Pyx_GIVEREF(__pyx_t_19);
6727  PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_23, __pyx_t_19);
6728  __Pyx_GIVEREF(__pyx_t_20);
6729  PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_23, __pyx_t_20);
6730  __pyx_t_19 = 0;
6731  __pyx_t_20 = 0;
6732  __pyx_t_24 = __Pyx_PyObject_Call(__pyx_t_22, __pyx_t_17, NULL); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 245, __pyx_L1_error)
6733  __Pyx_GOTREF(__pyx_t_24);
6734  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6735  }
6736  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
6737  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 245, __pyx_L1_error)
6738  __Pyx_GOTREF(__pyx_t_22);
6739  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 245, __pyx_L1_error)
6740  __Pyx_GOTREF(__pyx_t_17);
6741  __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 245, __pyx_L1_error)
6742  __Pyx_GOTREF(__pyx_t_20);
6743  __Pyx_GIVEREF(__pyx_t_22);
6744  PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_22);
6745  __Pyx_GIVEREF(__pyx_t_17);
6746  PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_17);
6747  __pyx_t_22 = 0;
6748  __pyx_t_17 = 0;
6749  __pyx_t_17 = PyObject_GetItem(__pyx_t_24, __pyx_t_20); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 245, __pyx_L1_error)
6750  __Pyx_GOTREF(__pyx_t_17);
6751  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
6752  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
6753  if (unlikely(__pyx_v_material_functions == Py_None)) {
6754  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6755  __PYX_ERR(0, 245, __pyx_L1_error)
6756  }
6757  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 245, __pyx_L1_error)
6758  __Pyx_GOTREF(__pyx_t_24);
6759  __pyx_t_22 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_24); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 245, __pyx_L1_error)
6760  __Pyx_GOTREF(__pyx_t_22);
6761  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
6762  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 245, __pyx_L1_error)
6763  __Pyx_GOTREF(__pyx_t_24);
6764  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 245, __pyx_L1_error)
6765  __Pyx_GOTREF(__pyx_t_19);
6766  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 245, __pyx_L1_error)
6767  __Pyx_GOTREF(__pyx_t_18);
6768  __pyx_t_21 = PyTuple_New(3); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 245, __pyx_L1_error)
6769  __Pyx_GOTREF(__pyx_t_21);
6770  __Pyx_GIVEREF(__pyx_t_24);
6771  PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_24);
6772  __Pyx_GIVEREF(__pyx_t_19);
6773  PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_19);
6774  __Pyx_GIVEREF(__pyx_t_18);
6775  PyTuple_SET_ITEM(__pyx_t_21, 2, __pyx_t_18);
6776  __pyx_t_24 = 0;
6777  __pyx_t_19 = 0;
6778  __pyx_t_18 = 0;
6779  __pyx_t_18 = PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_21); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 245, __pyx_L1_error)
6780  __Pyx_GOTREF(__pyx_t_18);
6781  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6782  __pyx_t_21 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 245, __pyx_L1_error)
6783  __Pyx_GOTREF(__pyx_t_21);
6784  __pyx_t_19 = NULL;
6785  __pyx_t_23 = 0;
6786  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_22))) {
6787  __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_22);
6788  if (likely(__pyx_t_19)) {
6789  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_22);
6790  __Pyx_INCREF(__pyx_t_19);
6791  __Pyx_INCREF(function);
6792  __Pyx_DECREF_SET(__pyx_t_22, function);
6793  __pyx_t_23 = 1;
6794  }
6795  }
6796  #if CYTHON_FAST_PYCALL
6797  if (PyFunction_Check(__pyx_t_22)) {
6798  PyObject *__pyx_temp[3] = {__pyx_t_19, __pyx_t_18, __pyx_t_21};
6799  __pyx_t_20 = __Pyx_PyFunction_FastCall(__pyx_t_22, __pyx_temp+1-__pyx_t_23, 2+__pyx_t_23); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 245, __pyx_L1_error)
6800  __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
6801  __Pyx_GOTREF(__pyx_t_20);
6802  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
6803  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6804  } else
6805  #endif
6806  #if CYTHON_FAST_PYCCALL
6807  if (__Pyx_PyFastCFunction_Check(__pyx_t_22)) {
6808  PyObject *__pyx_temp[3] = {__pyx_t_19, __pyx_t_18, __pyx_t_21};
6809  __pyx_t_20 = __Pyx_PyCFunction_FastCall(__pyx_t_22, __pyx_temp+1-__pyx_t_23, 2+__pyx_t_23); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 245, __pyx_L1_error)
6810  __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
6811  __Pyx_GOTREF(__pyx_t_20);
6812  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
6813  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6814  } else
6815  #endif
6816  {
6817  __pyx_t_24 = PyTuple_New(2+__pyx_t_23); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 245, __pyx_L1_error)
6818  __Pyx_GOTREF(__pyx_t_24);
6819  if (__pyx_t_19) {
6820  __Pyx_GIVEREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_19); __pyx_t_19 = NULL;
6821  }
6822  __Pyx_GIVEREF(__pyx_t_18);
6823  PyTuple_SET_ITEM(__pyx_t_24, 0+__pyx_t_23, __pyx_t_18);
6824  __Pyx_GIVEREF(__pyx_t_21);
6825  PyTuple_SET_ITEM(__pyx_t_24, 1+__pyx_t_23, __pyx_t_21);
6826  __pyx_t_18 = 0;
6827  __pyx_t_21 = 0;
6828  __pyx_t_20 = __Pyx_PyObject_Call(__pyx_t_22, __pyx_t_24, NULL); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 245, __pyx_L1_error)
6829  __Pyx_GOTREF(__pyx_t_20);
6830  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
6831  }
6832  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
6833  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 245, __pyx_L1_error)
6834  __Pyx_GOTREF(__pyx_t_22);
6835  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 245, __pyx_L1_error)
6836  __Pyx_GOTREF(__pyx_t_24);
6837  __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 245, __pyx_L1_error)
6838  __Pyx_GOTREF(__pyx_t_21);
6839  __Pyx_GIVEREF(__pyx_t_22);
6840  PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_22);
6841  __Pyx_GIVEREF(__pyx_t_24);
6842  PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_24);
6843  __pyx_t_22 = 0;
6844  __pyx_t_24 = 0;
6845  __pyx_t_24 = PyObject_GetItem(__pyx_t_20, __pyx_t_21); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 245, __pyx_L1_error)
6846  __Pyx_GOTREF(__pyx_t_24);
6847  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
6848  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6849  __pyx_t_21 = PyNumber_Add(__pyx_t_17, __pyx_t_24); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 245, __pyx_L1_error)
6850  __Pyx_GOTREF(__pyx_t_21);
6851  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6852  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
6853  __pyx_t_24 = __Pyx_PyFloat_AddObjC(__pyx_t_21, __pyx_float_1_0eneg_20, 1.0e-20, 0); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 245, __pyx_L1_error)
6854  __Pyx_GOTREF(__pyx_t_24);
6855  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6856  __pyx_t_25 = __pyx_PyFloat_AsDouble(__pyx_t_24); if (unlikely((__pyx_t_25 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 245, __pyx_L1_error)
6857  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
6858  __pyx_v_denom = __pyx_t_25;
6859 
6860  /* "subsurfaceTransportFunctions.pyx":246
6861  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J]
6862  * denom = material_functions[material_left](x[eN,ebN_local,k],t)[I,J] + material_functions[material_right](x[eN,ebN_local,k],t)[I,J] + 1.0e-20
6863  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom # <<<<<<<<<<<<<<
6864  *
6865  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t,
6866  */
6867  if (unlikely(__pyx_v_denom == 0)) {
6868  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
6869  __PYX_ERR(0, 246, __pyx_L1_error)
6870  }
6871  __pyx_t_26 = __pyx_v_eN;
6872  __pyx_t_27 = __pyx_v_ebN_local;
6873  __pyx_t_28 = __pyx_v_k;
6874  __pyx_t_29 = ((__pyx_v_I * __pyx_v_nd) + __pyx_v_J);
6875  __pyx_t_23 = -1;
6876  if (__pyx_t_26 < 0) {
6877  __pyx_t_26 += __pyx_pybuffernd_ebq_vals.diminfo[0].shape;
6878  if (unlikely(__pyx_t_26 < 0)) __pyx_t_23 = 0;
6879  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_ebq_vals.diminfo[0].shape)) __pyx_t_23 = 0;
6880  if (__pyx_t_27 < 0) {
6881  __pyx_t_27 += __pyx_pybuffernd_ebq_vals.diminfo[1].shape;
6882  if (unlikely(__pyx_t_27 < 0)) __pyx_t_23 = 1;
6883  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_ebq_vals.diminfo[1].shape)) __pyx_t_23 = 1;
6884  if (__pyx_t_28 < 0) {
6885  __pyx_t_28 += __pyx_pybuffernd_ebq_vals.diminfo[2].shape;
6886  if (unlikely(__pyx_t_28 < 0)) __pyx_t_23 = 2;
6887  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_ebq_vals.diminfo[2].shape)) __pyx_t_23 = 2;
6888  if (__pyx_t_29 < 0) {
6889  __pyx_t_29 += __pyx_pybuffernd_ebq_vals.diminfo[3].shape;
6890  if (unlikely(__pyx_t_29 < 0)) __pyx_t_23 = 3;
6891  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_ebq_vals.diminfo[3].shape)) __pyx_t_23 = 3;
6892  if (unlikely(__pyx_t_23 != -1)) {
6893  __Pyx_RaiseBufferIndexError(__pyx_t_23);
6894  __PYX_ERR(0, 246, __pyx_L1_error)
6895  }
6896  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_ebq_vals.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_ebq_vals.diminfo[1].strides, __pyx_t_28, __pyx_pybuffernd_ebq_vals.diminfo[2].strides, __pyx_t_29, __pyx_pybuffernd_ebq_vals.diminfo[3].strides) = (__pyx_v_numer / __pyx_v_denom);
6897  }
6898  }
6899  }
6900  }
6901  }
6902 
6903  /* "subsurfaceTransportFunctions.pyx":219
6904  * material_functions[material_right](x[eN,ebN_local,k],t))
6905  *
6906  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
6907  * double t,
6908  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
6909  */
6910 
6911  /* function exit code */
6912  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6913  goto __pyx_L0;
6914  __pyx_L1_error:;
6915  __Pyx_XDECREF(__pyx_t_17);
6916  __Pyx_XDECREF(__pyx_t_18);
6917  __Pyx_XDECREF(__pyx_t_19);
6918  __Pyx_XDECREF(__pyx_t_20);
6919  __Pyx_XDECREF(__pyx_t_21);
6920  __Pyx_XDECREF(__pyx_t_22);
6921  __Pyx_XDECREF(__pyx_t_24);
6922  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
6923  __Pyx_PyThreadState_declare
6924  __Pyx_PyThreadState_assign
6925  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
6926  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
6927  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
6928  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
6929  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
6930  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
6931  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
6932  __pyx_r = NULL;
6933  goto __pyx_L2;
6934  __pyx_L0:;
6935  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
6936  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
6937  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
6938  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
6939  __pyx_L2:;
6940  __Pyx_XGIVEREF(__pyx_r);
6941  __Pyx_RefNannyFinishContext();
6942  return __pyx_r;
6943 }
6944 
6945 /* "subsurfaceTransportFunctions.pyx":248
6946  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
6947  *
6948  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
6949  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
6950  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
6951  */
6952 
6953 /* Python wrapper */
6954 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6955 static char __pyx_doc_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage[] = "\n loop over quadrature array and evaluate function f(x,t) = 0.5(f^L_j(x,t)+f^R_k(x,t)) assuming element on left \n is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
6956 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage = {"evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage};
6957 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6958  double __pyx_v_t;
6959  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray = 0;
6960  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
6961  PyArrayObject *__pyx_v_x = 0;
6962  PyArrayObject *__pyx_v_ebq_global_vals = 0;
6963  PyObject *__pyx_v_material_functions = 0;
6964  PyObject *__pyx_r = 0;
6965  __Pyx_RefNannyDeclarations
6966  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage (wrapper)", 0);
6967  {
6968  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_x,&__pyx_n_s_ebq_global_vals,&__pyx_n_s_material_functions,0};
6969  PyObject* values[6] = {0,0,0,0,0,0};
6970  if (unlikely(__pyx_kwds)) {
6971  Py_ssize_t kw_args;
6972  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6973  switch (pos_args) {
6974  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6975  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6976  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6977  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6978  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6979  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6980  case 0: break;
6981  default: goto __pyx_L5_argtuple_error;
6982  }
6983  kw_args = PyDict_Size(__pyx_kwds);
6984  switch (pos_args) {
6985  case 0:
6986  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
6987  else goto __pyx_L5_argtuple_error;
6988  case 1:
6989  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
6990  else {
6991  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 1); __PYX_ERR(0, 248, __pyx_L3_error)
6992  }
6993  case 2:
6994  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
6995  else {
6996  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 2); __PYX_ERR(0, 248, __pyx_L3_error)
6997  }
6998  case 3:
6999  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
7000  else {
7001  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 3); __PYX_ERR(0, 248, __pyx_L3_error)
7002  }
7003  case 4:
7004  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ebq_global_vals)) != 0)) kw_args--;
7005  else {
7006  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 4); __PYX_ERR(0, 248, __pyx_L3_error)
7007  }
7008  case 5:
7009  if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
7010  else {
7011  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 5); __PYX_ERR(0, 248, __pyx_L3_error)
7012  }
7013  }
7014  if (unlikely(kw_args > 0)) {
7015  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage") < 0)) __PYX_ERR(0, 248, __pyx_L3_error)
7016  }
7017  } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
7018  goto __pyx_L5_argtuple_error;
7019  } else {
7020  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7021  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7022  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7023  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7024  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7025  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7026  }
7027  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 248, __pyx_L3_error)
7028  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[1]);
7029  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[2]);
7030  __pyx_v_x = ((PyArrayObject *)values[3]);
7031  __pyx_v_ebq_global_vals = ((PyArrayObject *)values[4]);
7032  __pyx_v_material_functions = ((PyObject*)values[5]);
7033  }
7034  goto __pyx_L4_argument_unpacking_done;
7035  __pyx_L5_argtuple_error:;
7036  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 248, __pyx_L3_error)
7037  __pyx_L3_error:;
7038  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
7039  __Pyx_RefNannyFinishContext();
7040  return NULL;
7041  __pyx_L4_argument_unpacking_done:;
7042  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 249, __pyx_L1_error)
7043  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 250, __pyx_L1_error)
7044  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 251, __pyx_L1_error)
7045  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_global_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_global_vals", 0))) __PYX_ERR(0, 252, __pyx_L1_error)
7046  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 253, __pyx_L1_error)
7047  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(__pyx_self, __pyx_v_t, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_x, __pyx_v_ebq_global_vals, __pyx_v_material_functions);
7048 
7049  /* function exit code */
7050  goto __pyx_L0;
7051  __pyx_L1_error:;
7052  __pyx_r = NULL;
7053  __pyx_L0:;
7054  __Pyx_RefNannyFinishContext();
7055  return __pyx_r;
7056 }
7057 
7058 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions) {
7059  int __pyx_v_ebN;
7060  int __pyx_v_material_left;
7061  int __pyx_v_material_right;
7062  npy_intp __pyx_v_k;
7063  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_global_vals;
7064  __Pyx_Buffer __pyx_pybuffer_ebq_global_vals;
7065  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
7066  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
7067  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
7068  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
7069  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
7070  __Pyx_Buffer __pyx_pybuffer_x;
7071  PyObject *__pyx_r = NULL;
7072  __Pyx_RefNannyDeclarations
7073  npy_intp __pyx_t_1;
7074  int __pyx_t_2;
7075  Py_ssize_t __pyx_t_3;
7076  Py_ssize_t __pyx_t_4;
7077  int __pyx_t_5;
7078  Py_ssize_t __pyx_t_6;
7079  Py_ssize_t __pyx_t_7;
7080  npy_intp __pyx_t_8;
7081  npy_intp __pyx_t_9;
7082  PyObject *__pyx_t_10 = NULL;
7083  PyObject *__pyx_t_11 = NULL;
7084  PyObject *__pyx_t_12 = NULL;
7085  PyObject *__pyx_t_13 = NULL;
7086  PyObject *__pyx_t_14 = NULL;
7087  PyObject *__pyx_t_15 = NULL;
7088  PyObject *__pyx_t_16 = NULL;
7089  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_17;
7090  Py_ssize_t __pyx_t_18;
7091  Py_ssize_t __pyx_t_19;
7092  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 0);
7093  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
7094  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
7095  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
7096  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
7097  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
7098  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
7099  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
7100  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
7101  __pyx_pybuffer_x.pybuffer.buf = NULL;
7102  __pyx_pybuffer_x.refcount = 0;
7103  __pyx_pybuffernd_x.data = NULL;
7104  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
7105  __pyx_pybuffer_ebq_global_vals.pybuffer.buf = NULL;
7106  __pyx_pybuffer_ebq_global_vals.refcount = 0;
7107  __pyx_pybuffernd_ebq_global_vals.data = NULL;
7108  __pyx_pybuffernd_ebq_global_vals.rcbuffer = &__pyx_pybuffer_ebq_global_vals;
7109  {
7110  __Pyx_BufFmt_StackElem __pyx_stack[1];
7111  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 248, __pyx_L1_error)
7112  }
7113  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
7114  {
7115  __Pyx_BufFmt_StackElem __pyx_stack[1];
7116  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 248, __pyx_L1_error)
7117  }
7118  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
7119  {
7120  __Pyx_BufFmt_StackElem __pyx_stack[1];
7121  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 248, __pyx_L1_error)
7122  }
7123  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
7124  {
7125  __Pyx_BufFmt_StackElem __pyx_stack[1];
7126  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_global_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 248, __pyx_L1_error)
7127  }
7128  __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[1];
7129 
7130  /* "subsurfaceTransportFunctions.pyx":263
7131  * cdef int ebN,material_left,material_right
7132  *
7133  * for ebN in range(x.shape[0]): # <<<<<<<<<<<<<<
7134  * material_left = elementBoundaryTypes[ebN,0]
7135  * material_right= elementBoundaryTypes[ebN,1]
7136  */
7137  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
7138  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
7139  __pyx_v_ebN = __pyx_t_2;
7140 
7141  /* "subsurfaceTransportFunctions.pyx":264
7142  *
7143  * for ebN in range(x.shape[0]):
7144  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
7145  * material_right= elementBoundaryTypes[ebN,1]
7146  * for k in range(x.shape[1]):
7147  */
7148  __pyx_t_3 = __pyx_v_ebN;
7149  __pyx_t_4 = 0;
7150  __pyx_t_5 = -1;
7151  if (__pyx_t_3 < 0) {
7152  __pyx_t_3 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
7153  if (unlikely(__pyx_t_3 < 0)) __pyx_t_5 = 0;
7154  } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_5 = 0;
7155  if (__pyx_t_4 < 0) {
7156  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
7157  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 1;
7158  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_5 = 1;
7159  if (unlikely(__pyx_t_5 != -1)) {
7160  __Pyx_RaiseBufferIndexError(__pyx_t_5);
7161  __PYX_ERR(0, 264, __pyx_L1_error)
7162  }
7163  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
7164 
7165  /* "subsurfaceTransportFunctions.pyx":265
7166  * for ebN in range(x.shape[0]):
7167  * material_left = elementBoundaryTypes[ebN,0]
7168  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
7169  * for k in range(x.shape[1]):
7170  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+
7171  */
7172  __pyx_t_6 = __pyx_v_ebN;
7173  __pyx_t_7 = 1;
7174  __pyx_t_5 = -1;
7175  if (__pyx_t_6 < 0) {
7176  __pyx_t_6 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
7177  if (unlikely(__pyx_t_6 < 0)) __pyx_t_5 = 0;
7178  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_5 = 0;
7179  if (__pyx_t_7 < 0) {
7180  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
7181  if (unlikely(__pyx_t_7 < 0)) __pyx_t_5 = 1;
7182  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_5 = 1;
7183  if (unlikely(__pyx_t_5 != -1)) {
7184  __Pyx_RaiseBufferIndexError(__pyx_t_5);
7185  __PYX_ERR(0, 265, __pyx_L1_error)
7186  }
7187  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
7188 
7189  /* "subsurfaceTransportFunctions.pyx":266
7190  * material_left = elementBoundaryTypes[ebN,0]
7191  * material_right= elementBoundaryTypes[ebN,1]
7192  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
7193  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+
7194  * material_functions[material_right](x[ebN,k],t))
7195  */
7196  __pyx_t_8 = (__pyx_v_x->dimensions[1]);
7197  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
7198  __pyx_v_k = __pyx_t_9;
7199 
7200  /* "subsurfaceTransportFunctions.pyx":267
7201  * material_right= elementBoundaryTypes[ebN,1]
7202  * for k in range(x.shape[1]):
7203  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+ # <<<<<<<<<<<<<<
7204  * material_functions[material_right](x[ebN,k],t))
7205  *
7206  */
7207  if (unlikely(__pyx_v_material_functions == Py_None)) {
7208  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7209  __PYX_ERR(0, 267, __pyx_L1_error)
7210  }
7211  __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 267, __pyx_L1_error)
7212  __Pyx_GOTREF(__pyx_t_11);
7213  __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 267, __pyx_L1_error)
7214  __Pyx_GOTREF(__pyx_t_12);
7215  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
7216  __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 267, __pyx_L1_error)
7217  __Pyx_GOTREF(__pyx_t_11);
7218  __pyx_t_13 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_k); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 267, __pyx_L1_error)
7219  __Pyx_GOTREF(__pyx_t_13);
7220  __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 267, __pyx_L1_error)
7221  __Pyx_GOTREF(__pyx_t_14);
7222  __Pyx_GIVEREF(__pyx_t_11);
7223  PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_11);
7224  __Pyx_GIVEREF(__pyx_t_13);
7225  PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_13);
7226  __pyx_t_11 = 0;
7227  __pyx_t_13 = 0;
7228  __pyx_t_13 = PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_14); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 267, __pyx_L1_error)
7229  __Pyx_GOTREF(__pyx_t_13);
7230  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7231  __pyx_t_14 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 267, __pyx_L1_error)
7232  __Pyx_GOTREF(__pyx_t_14);
7233  __pyx_t_11 = NULL;
7234  __pyx_t_5 = 0;
7235  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
7236  __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
7237  if (likely(__pyx_t_11)) {
7238  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
7239  __Pyx_INCREF(__pyx_t_11);
7240  __Pyx_INCREF(function);
7241  __Pyx_DECREF_SET(__pyx_t_12, function);
7242  __pyx_t_5 = 1;
7243  }
7244  }
7245  #if CYTHON_FAST_PYCALL
7246  if (PyFunction_Check(__pyx_t_12)) {
7247  PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_13, __pyx_t_14};
7248  __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 267, __pyx_L1_error)
7249  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
7250  __Pyx_GOTREF(__pyx_t_10);
7251  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7252  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7253  } else
7254  #endif
7255  #if CYTHON_FAST_PYCCALL
7256  if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
7257  PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_13, __pyx_t_14};
7258  __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 267, __pyx_L1_error)
7259  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
7260  __Pyx_GOTREF(__pyx_t_10);
7261  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7262  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7263  } else
7264  #endif
7265  {
7266  __pyx_t_15 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 267, __pyx_L1_error)
7267  __Pyx_GOTREF(__pyx_t_15);
7268  if (__pyx_t_11) {
7269  __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_11); __pyx_t_11 = NULL;
7270  }
7271  __Pyx_GIVEREF(__pyx_t_13);
7272  PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_5, __pyx_t_13);
7273  __Pyx_GIVEREF(__pyx_t_14);
7274  PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_5, __pyx_t_14);
7275  __pyx_t_13 = 0;
7276  __pyx_t_14 = 0;
7277  __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_15, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 267, __pyx_L1_error)
7278  __Pyx_GOTREF(__pyx_t_10);
7279  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7280  }
7281  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
7282 
7283  /* "subsurfaceTransportFunctions.pyx":268
7284  * for k in range(x.shape[1]):
7285  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+
7286  * material_functions[material_right](x[ebN,k],t)) # <<<<<<<<<<<<<<
7287  *
7288  *
7289  */
7290  if (unlikely(__pyx_v_material_functions == Py_None)) {
7291  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7292  __PYX_ERR(0, 268, __pyx_L1_error)
7293  }
7294  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 268, __pyx_L1_error)
7295  __Pyx_GOTREF(__pyx_t_15);
7296  __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_15); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 268, __pyx_L1_error)
7297  __Pyx_GOTREF(__pyx_t_14);
7298  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7299  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 268, __pyx_L1_error)
7300  __Pyx_GOTREF(__pyx_t_15);
7301  __pyx_t_13 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_k); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 268, __pyx_L1_error)
7302  __Pyx_GOTREF(__pyx_t_13);
7303  __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 268, __pyx_L1_error)
7304  __Pyx_GOTREF(__pyx_t_11);
7305  __Pyx_GIVEREF(__pyx_t_15);
7306  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_15);
7307  __Pyx_GIVEREF(__pyx_t_13);
7308  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_13);
7309  __pyx_t_15 = 0;
7310  __pyx_t_13 = 0;
7311  __pyx_t_13 = PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 268, __pyx_L1_error)
7312  __Pyx_GOTREF(__pyx_t_13);
7313  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
7314  __pyx_t_11 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 268, __pyx_L1_error)
7315  __Pyx_GOTREF(__pyx_t_11);
7316  __pyx_t_15 = NULL;
7317  __pyx_t_5 = 0;
7318  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
7319  __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
7320  if (likely(__pyx_t_15)) {
7321  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
7322  __Pyx_INCREF(__pyx_t_15);
7323  __Pyx_INCREF(function);
7324  __Pyx_DECREF_SET(__pyx_t_14, function);
7325  __pyx_t_5 = 1;
7326  }
7327  }
7328  #if CYTHON_FAST_PYCALL
7329  if (PyFunction_Check(__pyx_t_14)) {
7330  PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_13, __pyx_t_11};
7331  __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 268, __pyx_L1_error)
7332  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
7333  __Pyx_GOTREF(__pyx_t_12);
7334  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7335  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
7336  } else
7337  #endif
7338  #if CYTHON_FAST_PYCCALL
7339  if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
7340  PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_13, __pyx_t_11};
7341  __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 268, __pyx_L1_error)
7342  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
7343  __Pyx_GOTREF(__pyx_t_12);
7344  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7345  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
7346  } else
7347  #endif
7348  {
7349  __pyx_t_16 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 268, __pyx_L1_error)
7350  __Pyx_GOTREF(__pyx_t_16);
7351  if (__pyx_t_15) {
7352  __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15); __pyx_t_15 = NULL;
7353  }
7354  __Pyx_GIVEREF(__pyx_t_13);
7355  PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_5, __pyx_t_13);
7356  __Pyx_GIVEREF(__pyx_t_11);
7357  PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_5, __pyx_t_11);
7358  __pyx_t_13 = 0;
7359  __pyx_t_11 = 0;
7360  __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_16, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 268, __pyx_L1_error)
7361  __Pyx_GOTREF(__pyx_t_12);
7362  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7363  }
7364  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7365 
7366  /* "subsurfaceTransportFunctions.pyx":267
7367  * material_right= elementBoundaryTypes[ebN,1]
7368  * for k in range(x.shape[1]):
7369  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+ # <<<<<<<<<<<<<<
7370  * material_functions[material_right](x[ebN,k],t))
7371  *
7372  */
7373  __pyx_t_14 = PyNumber_Add(__pyx_t_10, __pyx_t_12); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 267, __pyx_L1_error)
7374  __Pyx_GOTREF(__pyx_t_14);
7375  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7376  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
7377  __pyx_t_12 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_14); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 267, __pyx_L1_error)
7378  __Pyx_GOTREF(__pyx_t_12);
7379  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7380  __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_17 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 267, __pyx_L1_error)
7381  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
7382  __pyx_t_18 = __pyx_v_ebN;
7383  __pyx_t_19 = __pyx_v_k;
7384  __pyx_t_5 = -1;
7385  if (__pyx_t_18 < 0) {
7386  __pyx_t_18 += __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape;
7387  if (unlikely(__pyx_t_18 < 0)) __pyx_t_5 = 0;
7388  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape)) __pyx_t_5 = 0;
7389  if (__pyx_t_19 < 0) {
7390  __pyx_t_19 += __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape;
7391  if (unlikely(__pyx_t_19 < 0)) __pyx_t_5 = 1;
7392  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape)) __pyx_t_5 = 1;
7393  if (unlikely(__pyx_t_5 != -1)) {
7394  __Pyx_RaiseBufferIndexError(__pyx_t_5);
7395  __PYX_ERR(0, 267, __pyx_L1_error)
7396  }
7397  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides) = __pyx_t_17;
7398  }
7399  }
7400 
7401  /* "subsurfaceTransportFunctions.pyx":248
7402  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
7403  *
7404  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
7405  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
7406  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
7407  */
7408 
7409  /* function exit code */
7410  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7411  goto __pyx_L0;
7412  __pyx_L1_error:;
7413  __Pyx_XDECREF(__pyx_t_10);
7414  __Pyx_XDECREF(__pyx_t_11);
7415  __Pyx_XDECREF(__pyx_t_12);
7416  __Pyx_XDECREF(__pyx_t_13);
7417  __Pyx_XDECREF(__pyx_t_14);
7418  __Pyx_XDECREF(__pyx_t_15);
7419  __Pyx_XDECREF(__pyx_t_16);
7420  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
7421  __Pyx_PyThreadState_declare
7422  __Pyx_PyThreadState_assign
7423  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
7424  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
7425  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
7426  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
7427  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
7428  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
7429  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
7430  __pyx_r = NULL;
7431  goto __pyx_L2;
7432  __pyx_L0:;
7433  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
7434  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
7435  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
7436  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
7437  __pyx_L2:;
7438  __Pyx_XGIVEREF(__pyx_r);
7439  __Pyx_RefNannyFinishContext();
7440  return __pyx_r;
7441 }
7442 
7443 /* "subsurfaceTransportFunctions.pyx":271
7444  *
7445  *
7446  * def evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
7447  * double t,
7448  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
7449  */
7450 
7451 /* Python wrapper */
7452 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7453 static char __pyx_doc_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage[] = "\n loop over quadrature array and evaluate function \ten f_{mn}(x,t) = f^L_{j,mn}(x,t)f^R_{k,mn}(x,t)/(f^L_{j,mn}(x,t)+f^R_{k,mn})\n assuming element on left is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
7454 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage = {"evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage};
7455 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7456  int __pyx_v_nd;
7457  double __pyx_v_t;
7458  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray = 0;
7459  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
7460  PyArrayObject *__pyx_v_x = 0;
7461  PyArrayObject *__pyx_v_ebq_global_vals = 0;
7462  PyObject *__pyx_v_material_functions = 0;
7463  PyObject *__pyx_r = 0;
7464  __Pyx_RefNannyDeclarations
7465  __Pyx_RefNannySetupContext("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage (wrapper)", 0);
7466  {
7467  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nd,&__pyx_n_s_t,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_x,&__pyx_n_s_ebq_global_vals,&__pyx_n_s_material_functions,0};
7468  PyObject* values[7] = {0,0,0,0,0,0,0};
7469  if (unlikely(__pyx_kwds)) {
7470  Py_ssize_t kw_args;
7471  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7472  switch (pos_args) {
7473  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
7474  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7475  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7476  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7477  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7478  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7479  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7480  case 0: break;
7481  default: goto __pyx_L5_argtuple_error;
7482  }
7483  kw_args = PyDict_Size(__pyx_kwds);
7484  switch (pos_args) {
7485  case 0:
7486  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
7487  else goto __pyx_L5_argtuple_error;
7488  case 1:
7489  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
7490  else {
7491  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 1); __PYX_ERR(0, 271, __pyx_L3_error)
7492  }
7493  case 2:
7494  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
7495  else {
7496  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 2); __PYX_ERR(0, 271, __pyx_L3_error)
7497  }
7498  case 3:
7499  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
7500  else {
7501  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 3); __PYX_ERR(0, 271, __pyx_L3_error)
7502  }
7503  case 4:
7504  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
7505  else {
7506  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 4); __PYX_ERR(0, 271, __pyx_L3_error)
7507  }
7508  case 5:
7509  if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ebq_global_vals)) != 0)) kw_args--;
7510  else {
7511  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 5); __PYX_ERR(0, 271, __pyx_L3_error)
7512  }
7513  case 6:
7514  if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
7515  else {
7516  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 6); __PYX_ERR(0, 271, __pyx_L3_error)
7517  }
7518  }
7519  if (unlikely(kw_args > 0)) {
7520  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage") < 0)) __PYX_ERR(0, 271, __pyx_L3_error)
7521  }
7522  } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
7523  goto __pyx_L5_argtuple_error;
7524  } else {
7525  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7526  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7527  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7528  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7529  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7530  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7531  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
7532  }
7533  __pyx_v_nd = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 271, __pyx_L3_error)
7534  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 272, __pyx_L3_error)
7535  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[2]);
7536  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[3]);
7537  __pyx_v_x = ((PyArrayObject *)values[4]);
7538  __pyx_v_ebq_global_vals = ((PyArrayObject *)values[5]);
7539  __pyx_v_material_functions = ((PyObject*)values[6]);
7540  }
7541  goto __pyx_L4_argument_unpacking_done;
7542  __pyx_L5_argtuple_error:;
7543  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 271, __pyx_L3_error)
7544  __pyx_L3_error:;
7545  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
7546  __Pyx_RefNannyFinishContext();
7547  return NULL;
7548  __pyx_L4_argument_unpacking_done:;
7549  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 273, __pyx_L1_error)
7550  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 274, __pyx_L1_error)
7551  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 275, __pyx_L1_error)
7552  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_global_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_global_vals", 0))) __PYX_ERR(0, 276, __pyx_L1_error)
7553  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 277, __pyx_L1_error)
7554  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(__pyx_self, __pyx_v_nd, __pyx_v_t, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_x, __pyx_v_ebq_global_vals, __pyx_v_material_functions);
7555 
7556  /* function exit code */
7557  goto __pyx_L0;
7558  __pyx_L1_error:;
7559  __pyx_r = NULL;
7560  __pyx_L0:;
7561  __Pyx_RefNannyFinishContext();
7562  return __pyx_r;
7563 }
7564 
7565 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, double __pyx_v_t, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions) {
7566  int __pyx_v_ebN;
7567  int __pyx_v_k;
7568  int __pyx_v_material_left;
7569  int __pyx_v_material_right;
7570  int __pyx_v_I;
7571  int __pyx_v_J;
7572  double __pyx_v_numer;
7573  double __pyx_v_denom;
7574  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_global_vals;
7575  __Pyx_Buffer __pyx_pybuffer_ebq_global_vals;
7576  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
7577  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
7578  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
7579  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
7580  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
7581  __Pyx_Buffer __pyx_pybuffer_x;
7582  PyObject *__pyx_r = NULL;
7583  __Pyx_RefNannyDeclarations
7584  npy_intp __pyx_t_1;
7585  int __pyx_t_2;
7586  Py_ssize_t __pyx_t_3;
7587  Py_ssize_t __pyx_t_4;
7588  int __pyx_t_5;
7589  Py_ssize_t __pyx_t_6;
7590  Py_ssize_t __pyx_t_7;
7591  npy_intp __pyx_t_8;
7592  int __pyx_t_9;
7593  int __pyx_t_10;
7594  int __pyx_t_11;
7595  int __pyx_t_12;
7596  PyObject *__pyx_t_13 = NULL;
7597  PyObject *__pyx_t_14 = NULL;
7598  PyObject *__pyx_t_15 = NULL;
7599  PyObject *__pyx_t_16 = NULL;
7600  PyObject *__pyx_t_17 = NULL;
7601  int __pyx_t_18;
7602  PyObject *__pyx_t_19 = NULL;
7603  PyObject *__pyx_t_20 = NULL;
7604  double __pyx_t_21;
7605  Py_ssize_t __pyx_t_22;
7606  Py_ssize_t __pyx_t_23;
7607  Py_ssize_t __pyx_t_24;
7608  __Pyx_RefNannySetupContext("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 0);
7609  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
7610  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
7611  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
7612  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
7613  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
7614  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
7615  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
7616  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
7617  __pyx_pybuffer_x.pybuffer.buf = NULL;
7618  __pyx_pybuffer_x.refcount = 0;
7619  __pyx_pybuffernd_x.data = NULL;
7620  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
7621  __pyx_pybuffer_ebq_global_vals.pybuffer.buf = NULL;
7622  __pyx_pybuffer_ebq_global_vals.refcount = 0;
7623  __pyx_pybuffernd_ebq_global_vals.data = NULL;
7624  __pyx_pybuffernd_ebq_global_vals.rcbuffer = &__pyx_pybuffer_ebq_global_vals;
7625  {
7626  __Pyx_BufFmt_StackElem __pyx_stack[1];
7627  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 271, __pyx_L1_error)
7628  }
7629  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
7630  {
7631  __Pyx_BufFmt_StackElem __pyx_stack[1];
7632  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 271, __pyx_L1_error)
7633  }
7634  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
7635  {
7636  __Pyx_BufFmt_StackElem __pyx_stack[1];
7637  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 271, __pyx_L1_error)
7638  }
7639  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
7640  {
7641  __Pyx_BufFmt_StackElem __pyx_stack[1];
7642  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_global_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 271, __pyx_L1_error)
7643  }
7644  __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[2];
7645 
7646  /* "subsurfaceTransportFunctions.pyx":288
7647  * cdef double numer,denom
7648  *
7649  * for ebN in range(x.shape[0]): # <<<<<<<<<<<<<<
7650  * material_left = elementBoundaryTypes[ebN,0]
7651  * material_right= elementBoundaryTypes[ebN,1]
7652  */
7653  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
7654  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
7655  __pyx_v_ebN = __pyx_t_2;
7656 
7657  /* "subsurfaceTransportFunctions.pyx":289
7658  *
7659  * for ebN in range(x.shape[0]):
7660  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
7661  * material_right= elementBoundaryTypes[ebN,1]
7662  * for k in range(x.shape[1]):
7663  */
7664  __pyx_t_3 = __pyx_v_ebN;
7665  __pyx_t_4 = 0;
7666  __pyx_t_5 = -1;
7667  if (__pyx_t_3 < 0) {
7668  __pyx_t_3 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
7669  if (unlikely(__pyx_t_3 < 0)) __pyx_t_5 = 0;
7670  } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_5 = 0;
7671  if (__pyx_t_4 < 0) {
7672  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
7673  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 1;
7674  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_5 = 1;
7675  if (unlikely(__pyx_t_5 != -1)) {
7676  __Pyx_RaiseBufferIndexError(__pyx_t_5);
7677  __PYX_ERR(0, 289, __pyx_L1_error)
7678  }
7679  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
7680 
7681  /* "subsurfaceTransportFunctions.pyx":290
7682  * for ebN in range(x.shape[0]):
7683  * material_left = elementBoundaryTypes[ebN,0]
7684  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
7685  * for k in range(x.shape[1]):
7686  * for I in range(nd):
7687  */
7688  __pyx_t_6 = __pyx_v_ebN;
7689  __pyx_t_7 = 1;
7690  __pyx_t_5 = -1;
7691  if (__pyx_t_6 < 0) {
7692  __pyx_t_6 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
7693  if (unlikely(__pyx_t_6 < 0)) __pyx_t_5 = 0;
7694  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_5 = 0;
7695  if (__pyx_t_7 < 0) {
7696  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
7697  if (unlikely(__pyx_t_7 < 0)) __pyx_t_5 = 1;
7698  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_5 = 1;
7699  if (unlikely(__pyx_t_5 != -1)) {
7700  __Pyx_RaiseBufferIndexError(__pyx_t_5);
7701  __PYX_ERR(0, 290, __pyx_L1_error)
7702  }
7703  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
7704 
7705  /* "subsurfaceTransportFunctions.pyx":291
7706  * material_left = elementBoundaryTypes[ebN,0]
7707  * material_right= elementBoundaryTypes[ebN,1]
7708  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
7709  * for I in range(nd):
7710  * for J in range(nd):
7711  */
7712  __pyx_t_8 = (__pyx_v_x->dimensions[1]);
7713  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_8; __pyx_t_5+=1) {
7714  __pyx_v_k = __pyx_t_5;
7715 
7716  /* "subsurfaceTransportFunctions.pyx":292
7717  * material_right= elementBoundaryTypes[ebN,1]
7718  * for k in range(x.shape[1]):
7719  * for I in range(nd): # <<<<<<<<<<<<<<
7720  * for J in range(nd):
7721  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J]
7722  */
7723  __pyx_t_9 = __pyx_v_nd;
7724  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
7725  __pyx_v_I = __pyx_t_10;
7726 
7727  /* "subsurfaceTransportFunctions.pyx":293
7728  * for k in range(x.shape[1]):
7729  * for I in range(nd):
7730  * for J in range(nd): # <<<<<<<<<<<<<<
7731  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J]
7732  * denom = material_functions[material_left](x[ebN,k],t)[I,J] + material_functions[material_right](x[ebN,k],t)[I,J] + 1.0e-20
7733  */
7734  __pyx_t_11 = __pyx_v_nd;
7735  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
7736  __pyx_v_J = __pyx_t_12;
7737 
7738  /* "subsurfaceTransportFunctions.pyx":294
7739  * for I in range(nd):
7740  * for J in range(nd):
7741  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J] # <<<<<<<<<<<<<<
7742  * denom = material_functions[material_left](x[ebN,k],t)[I,J] + material_functions[material_right](x[ebN,k],t)[I,J] + 1.0e-20
7743  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom
7744  */
7745  if (unlikely(__pyx_v_material_functions == Py_None)) {
7746  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7747  __PYX_ERR(0, 294, __pyx_L1_error)
7748  }
7749  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 294, __pyx_L1_error)
7750  __Pyx_GOTREF(__pyx_t_14);
7751  __pyx_t_15 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 294, __pyx_L1_error)
7752  __Pyx_GOTREF(__pyx_t_15);
7753  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7754  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 294, __pyx_L1_error)
7755  __Pyx_GOTREF(__pyx_t_14);
7756  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 294, __pyx_L1_error)
7757  __Pyx_GOTREF(__pyx_t_16);
7758  __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 294, __pyx_L1_error)
7759  __Pyx_GOTREF(__pyx_t_17);
7760  __Pyx_GIVEREF(__pyx_t_14);
7761  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_14);
7762  __Pyx_GIVEREF(__pyx_t_16);
7763  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_16);
7764  __pyx_t_14 = 0;
7765  __pyx_t_16 = 0;
7766  __pyx_t_16 = PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_17); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 294, __pyx_L1_error)
7767  __Pyx_GOTREF(__pyx_t_16);
7768  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
7769  __pyx_t_17 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 294, __pyx_L1_error)
7770  __Pyx_GOTREF(__pyx_t_17);
7771  __pyx_t_14 = NULL;
7772  __pyx_t_18 = 0;
7773  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_15))) {
7774  __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_15);
7775  if (likely(__pyx_t_14)) {
7776  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
7777  __Pyx_INCREF(__pyx_t_14);
7778  __Pyx_INCREF(function);
7779  __Pyx_DECREF_SET(__pyx_t_15, function);
7780  __pyx_t_18 = 1;
7781  }
7782  }
7783  #if CYTHON_FAST_PYCALL
7784  if (PyFunction_Check(__pyx_t_15)) {
7785  PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_t_16, __pyx_t_17};
7786  __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_15, __pyx_temp+1-__pyx_t_18, 2+__pyx_t_18); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 294, __pyx_L1_error)
7787  __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
7788  __Pyx_GOTREF(__pyx_t_13);
7789  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7790  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
7791  } else
7792  #endif
7793  #if CYTHON_FAST_PYCCALL
7794  if (__Pyx_PyFastCFunction_Check(__pyx_t_15)) {
7795  PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_t_16, __pyx_t_17};
7796  __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_15, __pyx_temp+1-__pyx_t_18, 2+__pyx_t_18); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 294, __pyx_L1_error)
7797  __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
7798  __Pyx_GOTREF(__pyx_t_13);
7799  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7800  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
7801  } else
7802  #endif
7803  {
7804  __pyx_t_19 = PyTuple_New(2+__pyx_t_18); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 294, __pyx_L1_error)
7805  __Pyx_GOTREF(__pyx_t_19);
7806  if (__pyx_t_14) {
7807  __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_14); __pyx_t_14 = NULL;
7808  }
7809  __Pyx_GIVEREF(__pyx_t_16);
7810  PyTuple_SET_ITEM(__pyx_t_19, 0+__pyx_t_18, __pyx_t_16);
7811  __Pyx_GIVEREF(__pyx_t_17);
7812  PyTuple_SET_ITEM(__pyx_t_19, 1+__pyx_t_18, __pyx_t_17);
7813  __pyx_t_16 = 0;
7814  __pyx_t_17 = 0;
7815  __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_19, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 294, __pyx_L1_error)
7816  __Pyx_GOTREF(__pyx_t_13);
7817  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
7818  }
7819  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7820  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 294, __pyx_L1_error)
7821  __Pyx_GOTREF(__pyx_t_15);
7822  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 294, __pyx_L1_error)
7823  __Pyx_GOTREF(__pyx_t_19);
7824  __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 294, __pyx_L1_error)
7825  __Pyx_GOTREF(__pyx_t_17);
7826  __Pyx_GIVEREF(__pyx_t_15);
7827  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_15);
7828  __Pyx_GIVEREF(__pyx_t_19);
7829  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_19);
7830  __pyx_t_15 = 0;
7831  __pyx_t_19 = 0;
7832  __pyx_t_19 = PyObject_GetItem(__pyx_t_13, __pyx_t_17); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 294, __pyx_L1_error)
7833  __Pyx_GOTREF(__pyx_t_19);
7834  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7835  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
7836  __pyx_t_17 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_19); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 294, __pyx_L1_error)
7837  __Pyx_GOTREF(__pyx_t_17);
7838  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
7839  if (unlikely(__pyx_v_material_functions == Py_None)) {
7840  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7841  __PYX_ERR(0, 294, __pyx_L1_error)
7842  }
7843  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 294, __pyx_L1_error)
7844  __Pyx_GOTREF(__pyx_t_13);
7845  __pyx_t_15 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_13); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 294, __pyx_L1_error)
7846  __Pyx_GOTREF(__pyx_t_15);
7847  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7848  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 294, __pyx_L1_error)
7849  __Pyx_GOTREF(__pyx_t_13);
7850  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 294, __pyx_L1_error)
7851  __Pyx_GOTREF(__pyx_t_16);
7852  __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 294, __pyx_L1_error)
7853  __Pyx_GOTREF(__pyx_t_14);
7854  __Pyx_GIVEREF(__pyx_t_13);
7855  PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13);
7856  __Pyx_GIVEREF(__pyx_t_16);
7857  PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_16);
7858  __pyx_t_13 = 0;
7859  __pyx_t_16 = 0;
7860  __pyx_t_16 = PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_14); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 294, __pyx_L1_error)
7861  __Pyx_GOTREF(__pyx_t_16);
7862  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7863  __pyx_t_14 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 294, __pyx_L1_error)
7864  __Pyx_GOTREF(__pyx_t_14);
7865  __pyx_t_13 = NULL;
7866  __pyx_t_18 = 0;
7867  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_15))) {
7868  __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_15);
7869  if (likely(__pyx_t_13)) {
7870  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
7871  __Pyx_INCREF(__pyx_t_13);
7872  __Pyx_INCREF(function);
7873  __Pyx_DECREF_SET(__pyx_t_15, function);
7874  __pyx_t_18 = 1;
7875  }
7876  }
7877  #if CYTHON_FAST_PYCALL
7878  if (PyFunction_Check(__pyx_t_15)) {
7879  PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_t_16, __pyx_t_14};
7880  __pyx_t_19 = __Pyx_PyFunction_FastCall(__pyx_t_15, __pyx_temp+1-__pyx_t_18, 2+__pyx_t_18); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 294, __pyx_L1_error)
7881  __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
7882  __Pyx_GOTREF(__pyx_t_19);
7883  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7884  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7885  } else
7886  #endif
7887  #if CYTHON_FAST_PYCCALL
7888  if (__Pyx_PyFastCFunction_Check(__pyx_t_15)) {
7889  PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_t_16, __pyx_t_14};
7890  __pyx_t_19 = __Pyx_PyCFunction_FastCall(__pyx_t_15, __pyx_temp+1-__pyx_t_18, 2+__pyx_t_18); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 294, __pyx_L1_error)
7891  __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
7892  __Pyx_GOTREF(__pyx_t_19);
7893  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7894  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7895  } else
7896  #endif
7897  {
7898  __pyx_t_20 = PyTuple_New(2+__pyx_t_18); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 294, __pyx_L1_error)
7899  __Pyx_GOTREF(__pyx_t_20);
7900  if (__pyx_t_13) {
7901  __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_13); __pyx_t_13 = NULL;
7902  }
7903  __Pyx_GIVEREF(__pyx_t_16);
7904  PyTuple_SET_ITEM(__pyx_t_20, 0+__pyx_t_18, __pyx_t_16);
7905  __Pyx_GIVEREF(__pyx_t_14);
7906  PyTuple_SET_ITEM(__pyx_t_20, 1+__pyx_t_18, __pyx_t_14);
7907  __pyx_t_16 = 0;
7908  __pyx_t_14 = 0;
7909  __pyx_t_19 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_20, NULL); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 294, __pyx_L1_error)
7910  __Pyx_GOTREF(__pyx_t_19);
7911  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
7912  }
7913  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7914  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 294, __pyx_L1_error)
7915  __Pyx_GOTREF(__pyx_t_15);
7916  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 294, __pyx_L1_error)
7917  __Pyx_GOTREF(__pyx_t_20);
7918  __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 294, __pyx_L1_error)
7919  __Pyx_GOTREF(__pyx_t_14);
7920  __Pyx_GIVEREF(__pyx_t_15);
7921  PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_15);
7922  __Pyx_GIVEREF(__pyx_t_20);
7923  PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_20);
7924  __pyx_t_15 = 0;
7925  __pyx_t_20 = 0;
7926  __pyx_t_20 = PyObject_GetItem(__pyx_t_19, __pyx_t_14); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 294, __pyx_L1_error)
7927  __Pyx_GOTREF(__pyx_t_20);
7928  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
7929  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7930  __pyx_t_14 = PyNumber_Multiply(__pyx_t_17, __pyx_t_20); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 294, __pyx_L1_error)
7931  __Pyx_GOTREF(__pyx_t_14);
7932  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
7933  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
7934  __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_14); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 294, __pyx_L1_error)
7935  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7936  __pyx_v_numer = __pyx_t_21;
7937 
7938  /* "subsurfaceTransportFunctions.pyx":295
7939  * for J in range(nd):
7940  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J]
7941  * denom = material_functions[material_left](x[ebN,k],t)[I,J] + material_functions[material_right](x[ebN,k],t)[I,J] + 1.0e-20 # <<<<<<<<<<<<<<
7942  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom
7943  *
7944  */
7945  if (unlikely(__pyx_v_material_functions == Py_None)) {
7946  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7947  __PYX_ERR(0, 295, __pyx_L1_error)
7948  }
7949  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 295, __pyx_L1_error)
7950  __Pyx_GOTREF(__pyx_t_20);
7951  __pyx_t_17 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_20); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
7952  __Pyx_GOTREF(__pyx_t_17);
7953  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
7954  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 295, __pyx_L1_error)
7955  __Pyx_GOTREF(__pyx_t_20);
7956  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 295, __pyx_L1_error)
7957  __Pyx_GOTREF(__pyx_t_19);
7958  __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 295, __pyx_L1_error)
7959  __Pyx_GOTREF(__pyx_t_15);
7960  __Pyx_GIVEREF(__pyx_t_20);
7961  PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_20);
7962  __Pyx_GIVEREF(__pyx_t_19);
7963  PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_19);
7964  __pyx_t_20 = 0;
7965  __pyx_t_19 = 0;
7966  __pyx_t_19 = PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_15); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 295, __pyx_L1_error)
7967  __Pyx_GOTREF(__pyx_t_19);
7968  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7969  __pyx_t_15 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 295, __pyx_L1_error)
7970  __Pyx_GOTREF(__pyx_t_15);
7971  __pyx_t_20 = NULL;
7972  __pyx_t_18 = 0;
7973  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_17))) {
7974  __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_17);
7975  if (likely(__pyx_t_20)) {
7976  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
7977  __Pyx_INCREF(__pyx_t_20);
7978  __Pyx_INCREF(function);
7979  __Pyx_DECREF_SET(__pyx_t_17, function);
7980  __pyx_t_18 = 1;
7981  }
7982  }
7983  #if CYTHON_FAST_PYCALL
7984  if (PyFunction_Check(__pyx_t_17)) {
7985  PyObject *__pyx_temp[3] = {__pyx_t_20, __pyx_t_19, __pyx_t_15};
7986  __pyx_t_14 = __Pyx_PyFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_18, 2+__pyx_t_18); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 295, __pyx_L1_error)
7987  __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
7988  __Pyx_GOTREF(__pyx_t_14);
7989  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
7990  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7991  } else
7992  #endif
7993  #if CYTHON_FAST_PYCCALL
7994  if (__Pyx_PyFastCFunction_Check(__pyx_t_17)) {
7995  PyObject *__pyx_temp[3] = {__pyx_t_20, __pyx_t_19, __pyx_t_15};
7996  __pyx_t_14 = __Pyx_PyCFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_18, 2+__pyx_t_18); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 295, __pyx_L1_error)
7997  __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
7998  __Pyx_GOTREF(__pyx_t_14);
7999  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8000  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8001  } else
8002  #endif
8003  {
8004  __pyx_t_16 = PyTuple_New(2+__pyx_t_18); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 295, __pyx_L1_error)
8005  __Pyx_GOTREF(__pyx_t_16);
8006  if (__pyx_t_20) {
8007  __Pyx_GIVEREF(__pyx_t_20); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_20); __pyx_t_20 = NULL;
8008  }
8009  __Pyx_GIVEREF(__pyx_t_19);
8010  PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_18, __pyx_t_19);
8011  __Pyx_GIVEREF(__pyx_t_15);
8012  PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_18, __pyx_t_15);
8013  __pyx_t_19 = 0;
8014  __pyx_t_15 = 0;
8015  __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_16, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 295, __pyx_L1_error)
8016  __Pyx_GOTREF(__pyx_t_14);
8017  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8018  }
8019  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8020  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8021  __Pyx_GOTREF(__pyx_t_17);
8022  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 295, __pyx_L1_error)
8023  __Pyx_GOTREF(__pyx_t_16);
8024  __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 295, __pyx_L1_error)
8025  __Pyx_GOTREF(__pyx_t_15);
8026  __Pyx_GIVEREF(__pyx_t_17);
8027  PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_17);
8028  __Pyx_GIVEREF(__pyx_t_16);
8029  PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_16);
8030  __pyx_t_17 = 0;
8031  __pyx_t_16 = 0;
8032  __pyx_t_16 = PyObject_GetItem(__pyx_t_14, __pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 295, __pyx_L1_error)
8033  __Pyx_GOTREF(__pyx_t_16);
8034  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
8035  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8036  if (unlikely(__pyx_v_material_functions == Py_None)) {
8037  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8038  __PYX_ERR(0, 295, __pyx_L1_error)
8039  }
8040  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 295, __pyx_L1_error)
8041  __Pyx_GOTREF(__pyx_t_14);
8042  __pyx_t_17 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_14); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8043  __Pyx_GOTREF(__pyx_t_17);
8044  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
8045  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 295, __pyx_L1_error)
8046  __Pyx_GOTREF(__pyx_t_14);
8047  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 295, __pyx_L1_error)
8048  __Pyx_GOTREF(__pyx_t_19);
8049  __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 295, __pyx_L1_error)
8050  __Pyx_GOTREF(__pyx_t_20);
8051  __Pyx_GIVEREF(__pyx_t_14);
8052  PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_14);
8053  __Pyx_GIVEREF(__pyx_t_19);
8054  PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_19);
8055  __pyx_t_14 = 0;
8056  __pyx_t_19 = 0;
8057  __pyx_t_19 = PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_20); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 295, __pyx_L1_error)
8058  __Pyx_GOTREF(__pyx_t_19);
8059  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
8060  __pyx_t_20 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 295, __pyx_L1_error)
8061  __Pyx_GOTREF(__pyx_t_20);
8062  __pyx_t_14 = NULL;
8063  __pyx_t_18 = 0;
8064  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_17))) {
8065  __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_17);
8066  if (likely(__pyx_t_14)) {
8067  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
8068  __Pyx_INCREF(__pyx_t_14);
8069  __Pyx_INCREF(function);
8070  __Pyx_DECREF_SET(__pyx_t_17, function);
8071  __pyx_t_18 = 1;
8072  }
8073  }
8074  #if CYTHON_FAST_PYCALL
8075  if (PyFunction_Check(__pyx_t_17)) {
8076  PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_t_19, __pyx_t_20};
8077  __pyx_t_15 = __Pyx_PyFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_18, 2+__pyx_t_18); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 295, __pyx_L1_error)
8078  __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
8079  __Pyx_GOTREF(__pyx_t_15);
8080  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8081  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
8082  } else
8083  #endif
8084  #if CYTHON_FAST_PYCCALL
8085  if (__Pyx_PyFastCFunction_Check(__pyx_t_17)) {
8086  PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_t_19, __pyx_t_20};
8087  __pyx_t_15 = __Pyx_PyCFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_18, 2+__pyx_t_18); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 295, __pyx_L1_error)
8088  __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
8089  __Pyx_GOTREF(__pyx_t_15);
8090  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8091  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
8092  } else
8093  #endif
8094  {
8095  __pyx_t_13 = PyTuple_New(2+__pyx_t_18); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 295, __pyx_L1_error)
8096  __Pyx_GOTREF(__pyx_t_13);
8097  if (__pyx_t_14) {
8098  __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_14); __pyx_t_14 = NULL;
8099  }
8100  __Pyx_GIVEREF(__pyx_t_19);
8101  PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_18, __pyx_t_19);
8102  __Pyx_GIVEREF(__pyx_t_20);
8103  PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_18, __pyx_t_20);
8104  __pyx_t_19 = 0;
8105  __pyx_t_20 = 0;
8106  __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_13, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 295, __pyx_L1_error)
8107  __Pyx_GOTREF(__pyx_t_15);
8108  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
8109  }
8110  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8111  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8112  __Pyx_GOTREF(__pyx_t_17);
8113  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 295, __pyx_L1_error)
8114  __Pyx_GOTREF(__pyx_t_13);
8115  __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 295, __pyx_L1_error)
8116  __Pyx_GOTREF(__pyx_t_20);
8117  __Pyx_GIVEREF(__pyx_t_17);
8118  PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_17);
8119  __Pyx_GIVEREF(__pyx_t_13);
8120  PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_13);
8121  __pyx_t_17 = 0;
8122  __pyx_t_13 = 0;
8123  __pyx_t_13 = PyObject_GetItem(__pyx_t_15, __pyx_t_20); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 295, __pyx_L1_error)
8124  __Pyx_GOTREF(__pyx_t_13);
8125  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8126  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
8127  __pyx_t_20 = PyNumber_Add(__pyx_t_16, __pyx_t_13); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 295, __pyx_L1_error)
8128  __Pyx_GOTREF(__pyx_t_20);
8129  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8130  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
8131  __pyx_t_13 = __Pyx_PyFloat_AddObjC(__pyx_t_20, __pyx_float_1_0eneg_20, 1.0e-20, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 295, __pyx_L1_error)
8132  __Pyx_GOTREF(__pyx_t_13);
8133  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
8134  __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_13); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 295, __pyx_L1_error)
8135  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
8136  __pyx_v_denom = __pyx_t_21;
8137 
8138  /* "subsurfaceTransportFunctions.pyx":296
8139  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J]
8140  * denom = material_functions[material_left](x[ebN,k],t)[I,J] + material_functions[material_right](x[ebN,k],t)[I,J] + 1.0e-20
8141  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom # <<<<<<<<<<<<<<
8142  *
8143  *
8144  */
8145  if (unlikely(__pyx_v_denom == 0)) {
8146  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
8147  __PYX_ERR(0, 296, __pyx_L1_error)
8148  }
8149  __pyx_t_22 = __pyx_v_ebN;
8150  __pyx_t_23 = __pyx_v_k;
8151  __pyx_t_24 = ((__pyx_v_I * __pyx_v_nd) + __pyx_v_J);
8152  __pyx_t_18 = -1;
8153  if (__pyx_t_22 < 0) {
8154  __pyx_t_22 += __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape;
8155  if (unlikely(__pyx_t_22 < 0)) __pyx_t_18 = 0;
8156  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape)) __pyx_t_18 = 0;
8157  if (__pyx_t_23 < 0) {
8158  __pyx_t_23 += __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape;
8159  if (unlikely(__pyx_t_23 < 0)) __pyx_t_18 = 1;
8160  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape)) __pyx_t_18 = 1;
8161  if (__pyx_t_24 < 0) {
8162  __pyx_t_24 += __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape;
8163  if (unlikely(__pyx_t_24 < 0)) __pyx_t_18 = 2;
8164  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape)) __pyx_t_18 = 2;
8165  if (unlikely(__pyx_t_18 != -1)) {
8166  __Pyx_RaiseBufferIndexError(__pyx_t_18);
8167  __PYX_ERR(0, 296, __pyx_L1_error)
8168  }
8169  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides, __pyx_t_24, __pyx_pybuffernd_ebq_global_vals.diminfo[2].strides) = (__pyx_v_numer / __pyx_v_denom);
8170  }
8171  }
8172  }
8173  }
8174 
8175  /* "subsurfaceTransportFunctions.pyx":271
8176  *
8177  *
8178  * def evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
8179  * double t,
8180  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
8181  */
8182 
8183  /* function exit code */
8184  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8185  goto __pyx_L0;
8186  __pyx_L1_error:;
8187  __Pyx_XDECREF(__pyx_t_13);
8188  __Pyx_XDECREF(__pyx_t_14);
8189  __Pyx_XDECREF(__pyx_t_15);
8190  __Pyx_XDECREF(__pyx_t_16);
8191  __Pyx_XDECREF(__pyx_t_17);
8192  __Pyx_XDECREF(__pyx_t_19);
8193  __Pyx_XDECREF(__pyx_t_20);
8194  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
8195  __Pyx_PyThreadState_declare
8196  __Pyx_PyThreadState_assign
8197  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
8198  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
8199  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
8200  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
8201  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
8202  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
8203  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
8204  __pyx_r = NULL;
8205  goto __pyx_L2;
8206  __pyx_L0:;
8207  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
8208  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
8209  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
8210  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
8211  __pyx_L2:;
8212  __Pyx_XGIVEREF(__pyx_r);
8213  __Pyx_RefNannyFinishContext();
8214  return __pyx_r;
8215 }
8216 
8217 /* "subsurfaceTransportFunctions.pyx":301
8218  *
8219  * ##################################################
8220  * def RE_NCP1_evaluateElementCoefficients_Linear(double rho, # <<<<<<<<<<<<<<
8221  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
8222  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
8223  */
8224 
8225 /* Python wrapper */
8226 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8227 static char __pyx_doc_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear[] = "\n routine for evaluating linaer interface (nodal) coefficients in NCP1 approximation for Darcy Flow\n\n Approximation:\n uses nodal quadrature where the nodes are face barycenters\n uses harmonic average for intrinsic permeability/ hydraulic conductivity\n assumes slight compressiblity for now\n\n TODO:\n everything\n \n ";
8228 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear = {"RE_NCP1_evaluateElementCoefficients_Linear", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear};
8229 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8230  double __pyx_v_rho;
8231  PyArrayObject *__pyx_v_gravity = 0;
8232  PyArrayObject *__pyx_v_rowptr = 0;
8233  PyArrayObject *__pyx_v_colind = 0;
8234  PyArrayObject *__pyx_v_KWs = 0;
8235  int __pyx_v_nSpace;
8236  int __pyx_v_nElements_global;
8237  int __pyx_v_nElementBoundaries_element;
8238  PyArrayObject *__pyx_v_elementNeighborsArray = 0;
8239  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
8240  PyArrayObject *__pyx_v_q_flin = 0;
8241  PyArrayObject *__pyx_v_q_alin = 0;
8242  PyObject *__pyx_r = 0;
8243  __Pyx_RefNannyDeclarations
8244  __Pyx_RefNannySetupContext("RE_NCP1_evaluateElementCoefficients_Linear (wrapper)", 0);
8245  {
8246  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rho,&__pyx_n_s_gravity,&__pyx_n_s_rowptr,&__pyx_n_s_colind,&__pyx_n_s_KWs,&__pyx_n_s_nSpace,&__pyx_n_s_nElements_global,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_q_flin,&__pyx_n_s_q_alin,0};
8247  PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
8248  if (unlikely(__pyx_kwds)) {
8249  Py_ssize_t kw_args;
8250  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8251  switch (pos_args) {
8252  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
8253  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
8254  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
8255  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
8256  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
8257  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
8258  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
8259  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8260  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8261  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8262  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8263  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8264  case 0: break;
8265  default: goto __pyx_L5_argtuple_error;
8266  }
8267  kw_args = PyDict_Size(__pyx_kwds);
8268  switch (pos_args) {
8269  case 0:
8270  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rho)) != 0)) kw_args--;
8271  else goto __pyx_L5_argtuple_error;
8272  case 1:
8273  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--;
8274  else {
8275  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 1); __PYX_ERR(0, 301, __pyx_L3_error)
8276  }
8277  case 2:
8278  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rowptr)) != 0)) kw_args--;
8279  else {
8280  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 2); __PYX_ERR(0, 301, __pyx_L3_error)
8281  }
8282  case 3:
8283  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_colind)) != 0)) kw_args--;
8284  else {
8285  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 3); __PYX_ERR(0, 301, __pyx_L3_error)
8286  }
8287  case 4:
8288  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_KWs)) != 0)) kw_args--;
8289  else {
8290  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 4); __PYX_ERR(0, 301, __pyx_L3_error)
8291  }
8292  case 5:
8293  if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nSpace)) != 0)) kw_args--;
8294  else {
8295  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 5); __PYX_ERR(0, 301, __pyx_L3_error)
8296  }
8297  case 6:
8298  if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
8299  else {
8300  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 6); __PYX_ERR(0, 301, __pyx_L3_error)
8301  }
8302  case 7:
8303  if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
8304  else {
8305  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 7); __PYX_ERR(0, 301, __pyx_L3_error)
8306  }
8307  case 8:
8308  if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
8309  else {
8310  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 8); __PYX_ERR(0, 301, __pyx_L3_error)
8311  }
8312  case 9:
8313  if (likely((values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
8314  else {
8315  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 9); __PYX_ERR(0, 301, __pyx_L3_error)
8316  }
8317  case 10:
8318  if (likely((values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_flin)) != 0)) kw_args--;
8319  else {
8320  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 10); __PYX_ERR(0, 301, __pyx_L3_error)
8321  }
8322  case 11:
8323  if (likely((values[11] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_alin)) != 0)) kw_args--;
8324  else {
8325  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 11); __PYX_ERR(0, 301, __pyx_L3_error)
8326  }
8327  }
8328  if (unlikely(kw_args > 0)) {
8329  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RE_NCP1_evaluateElementCoefficients_Linear") < 0)) __PYX_ERR(0, 301, __pyx_L3_error)
8330  }
8331  } else if (PyTuple_GET_SIZE(__pyx_args) != 12) {
8332  goto __pyx_L5_argtuple_error;
8333  } else {
8334  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8335  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8336  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8337  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8338  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8339  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
8340  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
8341  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
8342  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
8343  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
8344  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
8345  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
8346  }
8347  __pyx_v_rho = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_rho == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 301, __pyx_L3_error)
8348  __pyx_v_gravity = ((PyArrayObject *)values[1]);
8349  __pyx_v_rowptr = ((PyArrayObject *)values[2]);
8350  __pyx_v_colind = ((PyArrayObject *)values[3]);
8351  __pyx_v_KWs = ((PyArrayObject *)values[4]);
8352  __pyx_v_nSpace = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nSpace == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 307, __pyx_L3_error)
8353  __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_nElements_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L3_error)
8354  __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_nElementBoundaries_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 309, __pyx_L3_error)
8355  __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[8]);
8356  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[9]);
8357  __pyx_v_q_flin = ((PyArrayObject *)values[10]);
8358  __pyx_v_q_alin = ((PyArrayObject *)values[11]);
8359  }
8360  goto __pyx_L4_argument_unpacking_done;
8361  __pyx_L5_argtuple_error:;
8362  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 301, __pyx_L3_error)
8363  __pyx_L3_error:;
8364  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_evaluateElementCoefficients_Linear", __pyx_clineno, __pyx_lineno, __pyx_filename);
8365  __Pyx_RefNannyFinishContext();
8366  return NULL;
8367  __pyx_L4_argument_unpacking_done:;
8368  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gravity), __pyx_ptype_5numpy_ndarray, 1, "gravity", 0))) __PYX_ERR(0, 302, __pyx_L1_error)
8369  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rowptr), __pyx_ptype_5numpy_ndarray, 1, "rowptr", 0))) __PYX_ERR(0, 303, __pyx_L1_error)
8370  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_colind), __pyx_ptype_5numpy_ndarray, 1, "colind", 0))) __PYX_ERR(0, 304, __pyx_L1_error)
8371  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_KWs), __pyx_ptype_5numpy_ndarray, 1, "KWs", 0))) __PYX_ERR(0, 305, __pyx_L1_error)
8372  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1, "elementNeighborsArray", 0))) __PYX_ERR(0, 310, __pyx_L1_error)
8373  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 311, __pyx_L1_error)
8374  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_flin), __pyx_ptype_5numpy_ndarray, 1, "q_flin", 0))) __PYX_ERR(0, 312, __pyx_L1_error)
8375  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_alin), __pyx_ptype_5numpy_ndarray, 1, "q_alin", 0))) __PYX_ERR(0, 313, __pyx_L1_error)
8376  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear(__pyx_self, __pyx_v_rho, __pyx_v_gravity, __pyx_v_rowptr, __pyx_v_colind, __pyx_v_KWs, __pyx_v_nSpace, __pyx_v_nElements_global, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_elementMaterialTypes, __pyx_v_q_flin, __pyx_v_q_alin);
8377 
8378  /* function exit code */
8379  goto __pyx_L0;
8380  __pyx_L1_error:;
8381  __pyx_r = NULL;
8382  __pyx_L0:;
8383  __Pyx_RefNannyFinishContext();
8384  return __pyx_r;
8385 }
8386 
8387 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rho, PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, PyArrayObject *__pyx_v_KWs, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin) {
8388  int __pyx_v_eN;
8389  int __pyx_v_eN_neighbor;
8390  int __pyx_v_ii;
8391  int __pyx_v_I;
8392  int __pyx_v_ebN;
8393  int __pyx_v_matID;
8394  int __pyx_v_matID_neig;
8395  CYTHON_UNUSED int __pyx_v_nSpace2;
8396  int __pyx_v_nnz;
8397  PyArrayObject *__pyx_v_a_eN = 0;
8398  PyArrayObject *__pyx_v_a_neig = 0;
8399  PyArrayObject *__pyx_v_a_avg = 0;
8400  __Pyx_LocalBuf_ND __pyx_pybuffernd_KWs;
8401  __Pyx_Buffer __pyx_pybuffer_KWs;
8402  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_avg;
8403  __Pyx_Buffer __pyx_pybuffer_a_avg;
8404  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_eN;
8405  __Pyx_Buffer __pyx_pybuffer_a_eN;
8406  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_neig;
8407  __Pyx_Buffer __pyx_pybuffer_a_neig;
8408  __Pyx_LocalBuf_ND __pyx_pybuffernd_colind;
8409  __Pyx_Buffer __pyx_pybuffer_colind;
8410  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
8411  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
8412  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementNeighborsArray;
8413  __Pyx_Buffer __pyx_pybuffer_elementNeighborsArray;
8414  __Pyx_LocalBuf_ND __pyx_pybuffernd_gravity;
8415  __Pyx_Buffer __pyx_pybuffer_gravity;
8416  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_alin;
8417  __Pyx_Buffer __pyx_pybuffer_q_alin;
8418  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_flin;
8419  __Pyx_Buffer __pyx_pybuffer_q_flin;
8420  __Pyx_LocalBuf_ND __pyx_pybuffernd_rowptr;
8421  __Pyx_Buffer __pyx_pybuffer_rowptr;
8422  PyObject *__pyx_r = NULL;
8423  __Pyx_RefNannyDeclarations
8424  Py_ssize_t __pyx_t_1;
8425  int __pyx_t_2;
8426  PyObject *__pyx_t_3 = NULL;
8427  PyObject *__pyx_t_4 = NULL;
8428  PyObject *__pyx_t_5 = NULL;
8429  PyObject *__pyx_t_6 = NULL;
8430  PyObject *__pyx_t_7 = NULL;
8431  PyArrayObject *__pyx_t_8 = NULL;
8432  PyArrayObject *__pyx_t_9 = NULL;
8433  PyArrayObject *__pyx_t_10 = NULL;
8434  int __pyx_t_11;
8435  Py_ssize_t __pyx_t_12;
8436  int __pyx_t_13;
8437  int __pyx_t_14;
8438  Py_ssize_t __pyx_t_15;
8439  Py_ssize_t __pyx_t_16;
8440  int __pyx_t_17;
8441  Py_ssize_t __pyx_t_18;
8442  Py_ssize_t __pyx_t_19;
8443  Py_ssize_t __pyx_t_20;
8444  int __pyx_t_21;
8445  Py_ssize_t __pyx_t_22;
8446  int __pyx_t_23;
8447  Py_ssize_t __pyx_t_24;
8448  int __pyx_t_25;
8449  Py_ssize_t __pyx_t_26;
8450  Py_ssize_t __pyx_t_27;
8451  Py_ssize_t __pyx_t_28;
8452  Py_ssize_t __pyx_t_29;
8453  Py_ssize_t __pyx_t_30;
8454  Py_ssize_t __pyx_t_31;
8455  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_32;
8456  Py_ssize_t __pyx_t_33;
8457  Py_ssize_t __pyx_t_34;
8458  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_35;
8459  Py_ssize_t __pyx_t_36;
8460  Py_ssize_t __pyx_t_37;
8461  Py_ssize_t __pyx_t_38;
8462  Py_ssize_t __pyx_t_39;
8463  Py_ssize_t __pyx_t_40;
8464  Py_ssize_t __pyx_t_41;
8465  Py_ssize_t __pyx_t_42;
8466  Py_ssize_t __pyx_t_43;
8467  Py_ssize_t __pyx_t_44;
8468  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_45;
8469  Py_ssize_t __pyx_t_46;
8470  Py_ssize_t __pyx_t_47;
8471  int __pyx_t_48;
8472  Py_ssize_t __pyx_t_49;
8473  Py_ssize_t __pyx_t_50;
8474  Py_ssize_t __pyx_t_51;
8475  Py_ssize_t __pyx_t_52;
8476  Py_ssize_t __pyx_t_53;
8477  __Pyx_RefNannySetupContext("RE_NCP1_evaluateElementCoefficients_Linear", 0);
8478  __pyx_pybuffer_a_eN.pybuffer.buf = NULL;
8479  __pyx_pybuffer_a_eN.refcount = 0;
8480  __pyx_pybuffernd_a_eN.data = NULL;
8481  __pyx_pybuffernd_a_eN.rcbuffer = &__pyx_pybuffer_a_eN;
8482  __pyx_pybuffer_a_neig.pybuffer.buf = NULL;
8483  __pyx_pybuffer_a_neig.refcount = 0;
8484  __pyx_pybuffernd_a_neig.data = NULL;
8485  __pyx_pybuffernd_a_neig.rcbuffer = &__pyx_pybuffer_a_neig;
8486  __pyx_pybuffer_a_avg.pybuffer.buf = NULL;
8487  __pyx_pybuffer_a_avg.refcount = 0;
8488  __pyx_pybuffernd_a_avg.data = NULL;
8489  __pyx_pybuffernd_a_avg.rcbuffer = &__pyx_pybuffer_a_avg;
8490  __pyx_pybuffer_gravity.pybuffer.buf = NULL;
8491  __pyx_pybuffer_gravity.refcount = 0;
8492  __pyx_pybuffernd_gravity.data = NULL;
8493  __pyx_pybuffernd_gravity.rcbuffer = &__pyx_pybuffer_gravity;
8494  __pyx_pybuffer_rowptr.pybuffer.buf = NULL;
8495  __pyx_pybuffer_rowptr.refcount = 0;
8496  __pyx_pybuffernd_rowptr.data = NULL;
8497  __pyx_pybuffernd_rowptr.rcbuffer = &__pyx_pybuffer_rowptr;
8498  __pyx_pybuffer_colind.pybuffer.buf = NULL;
8499  __pyx_pybuffer_colind.refcount = 0;
8500  __pyx_pybuffernd_colind.data = NULL;
8501  __pyx_pybuffernd_colind.rcbuffer = &__pyx_pybuffer_colind;
8502  __pyx_pybuffer_KWs.pybuffer.buf = NULL;
8503  __pyx_pybuffer_KWs.refcount = 0;
8504  __pyx_pybuffernd_KWs.data = NULL;
8505  __pyx_pybuffernd_KWs.rcbuffer = &__pyx_pybuffer_KWs;
8506  __pyx_pybuffer_elementNeighborsArray.pybuffer.buf = NULL;
8507  __pyx_pybuffer_elementNeighborsArray.refcount = 0;
8508  __pyx_pybuffernd_elementNeighborsArray.data = NULL;
8509  __pyx_pybuffernd_elementNeighborsArray.rcbuffer = &__pyx_pybuffer_elementNeighborsArray;
8510  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
8511  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
8512  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
8513  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
8514  __pyx_pybuffer_q_flin.pybuffer.buf = NULL;
8515  __pyx_pybuffer_q_flin.refcount = 0;
8516  __pyx_pybuffernd_q_flin.data = NULL;
8517  __pyx_pybuffernd_q_flin.rcbuffer = &__pyx_pybuffer_q_flin;
8518  __pyx_pybuffer_q_alin.pybuffer.buf = NULL;
8519  __pyx_pybuffer_q_alin.refcount = 0;
8520  __pyx_pybuffernd_q_alin.data = NULL;
8521  __pyx_pybuffernd_q_alin.rcbuffer = &__pyx_pybuffer_q_alin;
8522  {
8523  __Pyx_BufFmt_StackElem __pyx_stack[1];
8524  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer, (PyObject*)__pyx_v_gravity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
8525  }
8526  __pyx_pybuffernd_gravity.diminfo[0].strides = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gravity.diminfo[0].shape = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.shape[0];
8527  {
8528  __Pyx_BufFmt_StackElem __pyx_stack[1];
8529  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_rowptr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
8530  }
8531  __pyx_pybuffernd_rowptr.diminfo[0].strides = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rowptr.diminfo[0].shape = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.shape[0];
8532  {
8533  __Pyx_BufFmt_StackElem __pyx_stack[1];
8534  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_colind.rcbuffer->pybuffer, (PyObject*)__pyx_v_colind, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
8535  }
8536  __pyx_pybuffernd_colind.diminfo[0].strides = __pyx_pybuffernd_colind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_colind.diminfo[0].shape = __pyx_pybuffernd_colind.rcbuffer->pybuffer.shape[0];
8537  {
8538  __Pyx_BufFmt_StackElem __pyx_stack[1];
8539  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_KWs.rcbuffer->pybuffer, (PyObject*)__pyx_v_KWs, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
8540  }
8541  __pyx_pybuffernd_KWs.diminfo[0].strides = __pyx_pybuffernd_KWs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_KWs.diminfo[0].shape = __pyx_pybuffernd_KWs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_KWs.diminfo[1].strides = __pyx_pybuffernd_KWs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_KWs.diminfo[1].shape = __pyx_pybuffernd_KWs.rcbuffer->pybuffer.shape[1];
8542  {
8543  __Pyx_BufFmt_StackElem __pyx_stack[1];
8544  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementNeighborsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
8545  }
8546  __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[1];
8547  {
8548  __Pyx_BufFmt_StackElem __pyx_stack[1];
8549  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
8550  }
8551  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
8552  {
8553  __Pyx_BufFmt_StackElem __pyx_stack[1];
8554  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_flin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
8555  }
8556  __pyx_pybuffernd_q_flin.diminfo[0].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_flin.diminfo[0].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_flin.diminfo[1].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_flin.diminfo[1].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_flin.diminfo[2].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_flin.diminfo[2].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[2];
8557  {
8558  __Pyx_BufFmt_StackElem __pyx_stack[1];
8559  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_alin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
8560  }
8561  __pyx_pybuffernd_q_alin.diminfo[0].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_alin.diminfo[0].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_alin.diminfo[1].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_alin.diminfo[1].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_alin.diminfo[2].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_alin.diminfo[2].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[2];
8562 
8563  /* "subsurfaceTransportFunctions.pyx":328
8564  * #temporaries
8565  * cdef int eN,eN_neighbor,ii,I,ebN,matID,matID_neig
8566  * cdef int nSpace2 = nSpace*nSpace # <<<<<<<<<<<<<<
8567  * cdef int nnz = rowptr[nSpace]
8568  *
8569  */
8570  __pyx_v_nSpace2 = (__pyx_v_nSpace * __pyx_v_nSpace);
8571 
8572  /* "subsurfaceTransportFunctions.pyx":329
8573  * cdef int eN,eN_neighbor,ii,I,ebN,matID,matID_neig
8574  * cdef int nSpace2 = nSpace*nSpace
8575  * cdef int nnz = rowptr[nSpace] # <<<<<<<<<<<<<<
8576  *
8577  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_eN = numpy.zeros(nnz,'d')
8578  */
8579  __pyx_t_1 = __pyx_v_nSpace;
8580  __pyx_t_2 = -1;
8581  if (__pyx_t_1 < 0) {
8582  __pyx_t_1 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
8583  if (unlikely(__pyx_t_1 < 0)) __pyx_t_2 = 0;
8584  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_2 = 0;
8585  if (unlikely(__pyx_t_2 != -1)) {
8586  __Pyx_RaiseBufferIndexError(__pyx_t_2);
8587  __PYX_ERR(0, 329, __pyx_L1_error)
8588  }
8589  __pyx_v_nnz = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_rowptr.diminfo[0].strides));
8590 
8591  /* "subsurfaceTransportFunctions.pyx":331
8592  * cdef int nnz = rowptr[nSpace]
8593  *
8594  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_eN = numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
8595  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_neig = numpy.zeros(nnz,'d')
8596  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_avg = numpy.zeros(nnz,'d')
8597  */
8598  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 331, __pyx_L1_error)
8599  __Pyx_GOTREF(__pyx_t_4);
8600  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 331, __pyx_L1_error)
8601  __Pyx_GOTREF(__pyx_t_5);
8602  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8603  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 331, __pyx_L1_error)
8604  __Pyx_GOTREF(__pyx_t_4);
8605  __pyx_t_6 = NULL;
8606  __pyx_t_2 = 0;
8607  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
8608  __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
8609  if (likely(__pyx_t_6)) {
8610  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
8611  __Pyx_INCREF(__pyx_t_6);
8612  __Pyx_INCREF(function);
8613  __Pyx_DECREF_SET(__pyx_t_5, function);
8614  __pyx_t_2 = 1;
8615  }
8616  }
8617  #if CYTHON_FAST_PYCALL
8618  if (PyFunction_Check(__pyx_t_5)) {
8619  PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_n_s_d};
8620  __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error)
8621  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
8622  __Pyx_GOTREF(__pyx_t_3);
8623  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8624  } else
8625  #endif
8626  #if CYTHON_FAST_PYCCALL
8627  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
8628  PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_n_s_d};
8629  __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error)
8630  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
8631  __Pyx_GOTREF(__pyx_t_3);
8632  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8633  } else
8634  #endif
8635  {
8636  __pyx_t_7 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 331, __pyx_L1_error)
8637  __Pyx_GOTREF(__pyx_t_7);
8638  if (__pyx_t_6) {
8639  __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
8640  }
8641  __Pyx_GIVEREF(__pyx_t_4);
8642  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_2, __pyx_t_4);
8643  __Pyx_INCREF(__pyx_n_s_d);
8644  __Pyx_GIVEREF(__pyx_n_s_d);
8645  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_2, __pyx_n_s_d);
8646  __pyx_t_4 = 0;
8647  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error)
8648  __Pyx_GOTREF(__pyx_t_3);
8649  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8650  }
8651  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8652  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 331, __pyx_L1_error)
8653  __pyx_t_8 = ((PyArrayObject *)__pyx_t_3);
8654  {
8655  __Pyx_BufFmt_StackElem __pyx_stack[1];
8656  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_eN.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
8657  __pyx_v_a_eN = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf = NULL;
8658  __PYX_ERR(0, 331, __pyx_L1_error)
8659  } else {__pyx_pybuffernd_a_eN.diminfo[0].strides = __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_eN.diminfo[0].shape = __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.shape[0];
8660  }
8661  }
8662  __pyx_t_8 = 0;
8663  __pyx_v_a_eN = ((PyArrayObject *)__pyx_t_3);
8664  __pyx_t_3 = 0;
8665 
8666  /* "subsurfaceTransportFunctions.pyx":332
8667  *
8668  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_eN = numpy.zeros(nnz,'d')
8669  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_neig = numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
8670  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_avg = numpy.zeros(nnz,'d')
8671  *
8672  */
8673  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 332, __pyx_L1_error)
8674  __Pyx_GOTREF(__pyx_t_5);
8675  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 332, __pyx_L1_error)
8676  __Pyx_GOTREF(__pyx_t_7);
8677  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8678  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 332, __pyx_L1_error)
8679  __Pyx_GOTREF(__pyx_t_5);
8680  __pyx_t_4 = NULL;
8681  __pyx_t_2 = 0;
8682  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
8683  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
8684  if (likely(__pyx_t_4)) {
8685  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
8686  __Pyx_INCREF(__pyx_t_4);
8687  __Pyx_INCREF(function);
8688  __Pyx_DECREF_SET(__pyx_t_7, function);
8689  __pyx_t_2 = 1;
8690  }
8691  }
8692  #if CYTHON_FAST_PYCALL
8693  if (PyFunction_Check(__pyx_t_7)) {
8694  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
8695  __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error)
8696  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8697  __Pyx_GOTREF(__pyx_t_3);
8698  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8699  } else
8700  #endif
8701  #if CYTHON_FAST_PYCCALL
8702  if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
8703  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
8704  __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error)
8705  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8706  __Pyx_GOTREF(__pyx_t_3);
8707  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8708  } else
8709  #endif
8710  {
8711  __pyx_t_6 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 332, __pyx_L1_error)
8712  __Pyx_GOTREF(__pyx_t_6);
8713  if (__pyx_t_4) {
8714  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
8715  }
8716  __Pyx_GIVEREF(__pyx_t_5);
8717  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_2, __pyx_t_5);
8718  __Pyx_INCREF(__pyx_n_s_d);
8719  __Pyx_GIVEREF(__pyx_n_s_d);
8720  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_2, __pyx_n_s_d);
8721  __pyx_t_5 = 0;
8722  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error)
8723  __Pyx_GOTREF(__pyx_t_3);
8724  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8725  }
8726  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8727  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 332, __pyx_L1_error)
8728  __pyx_t_9 = ((PyArrayObject *)__pyx_t_3);
8729  {
8730  __Pyx_BufFmt_StackElem __pyx_stack[1];
8731  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_neig.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
8732  __pyx_v_a_neig = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf = NULL;
8733  __PYX_ERR(0, 332, __pyx_L1_error)
8734  } else {__pyx_pybuffernd_a_neig.diminfo[0].strides = __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_neig.diminfo[0].shape = __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.shape[0];
8735  }
8736  }
8737  __pyx_t_9 = 0;
8738  __pyx_v_a_neig = ((PyArrayObject *)__pyx_t_3);
8739  __pyx_t_3 = 0;
8740 
8741  /* "subsurfaceTransportFunctions.pyx":333
8742  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_eN = numpy.zeros(nnz,'d')
8743  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_neig = numpy.zeros(nnz,'d')
8744  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_avg = numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
8745  *
8746  * #loop through and evaluate
8747  */
8748  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 333, __pyx_L1_error)
8749  __Pyx_GOTREF(__pyx_t_7);
8750  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 333, __pyx_L1_error)
8751  __Pyx_GOTREF(__pyx_t_6);
8752  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8753  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 333, __pyx_L1_error)
8754  __Pyx_GOTREF(__pyx_t_7);
8755  __pyx_t_5 = NULL;
8756  __pyx_t_2 = 0;
8757  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
8758  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
8759  if (likely(__pyx_t_5)) {
8760  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
8761  __Pyx_INCREF(__pyx_t_5);
8762  __Pyx_INCREF(function);
8763  __Pyx_DECREF_SET(__pyx_t_6, function);
8764  __pyx_t_2 = 1;
8765  }
8766  }
8767  #if CYTHON_FAST_PYCALL
8768  if (PyFunction_Check(__pyx_t_6)) {
8769  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_7, __pyx_n_s_d};
8770  __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
8771  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
8772  __Pyx_GOTREF(__pyx_t_3);
8773  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8774  } else
8775  #endif
8776  #if CYTHON_FAST_PYCCALL
8777  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
8778  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_7, __pyx_n_s_d};
8779  __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
8780  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
8781  __Pyx_GOTREF(__pyx_t_3);
8782  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8783  } else
8784  #endif
8785  {
8786  __pyx_t_4 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 333, __pyx_L1_error)
8787  __Pyx_GOTREF(__pyx_t_4);
8788  if (__pyx_t_5) {
8789  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
8790  }
8791  __Pyx_GIVEREF(__pyx_t_7);
8792  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_2, __pyx_t_7);
8793  __Pyx_INCREF(__pyx_n_s_d);
8794  __Pyx_GIVEREF(__pyx_n_s_d);
8795  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_2, __pyx_n_s_d);
8796  __pyx_t_7 = 0;
8797  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
8798  __Pyx_GOTREF(__pyx_t_3);
8799  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8800  }
8801  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8802  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 333, __pyx_L1_error)
8803  __pyx_t_10 = ((PyArrayObject *)__pyx_t_3);
8804  {
8805  __Pyx_BufFmt_StackElem __pyx_stack[1];
8806  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_avg.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
8807  __pyx_v_a_avg = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.buf = NULL;
8808  __PYX_ERR(0, 333, __pyx_L1_error)
8809  } else {__pyx_pybuffernd_a_avg.diminfo[0].strides = __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_avg.diminfo[0].shape = __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.shape[0];
8810  }
8811  }
8812  __pyx_t_10 = 0;
8813  __pyx_v_a_avg = ((PyArrayObject *)__pyx_t_3);
8814  __pyx_t_3 = 0;
8815 
8816  /* "subsurfaceTransportFunctions.pyx":336
8817  *
8818  * #loop through and evaluate
8819  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
8820  * matID = elementMaterialTypes[eN]
8821  * for ii in range(nnz):
8822  */
8823  __pyx_t_2 = __pyx_v_nElements_global;
8824  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_2; __pyx_t_11+=1) {
8825  __pyx_v_eN = __pyx_t_11;
8826 
8827  /* "subsurfaceTransportFunctions.pyx":337
8828  * #loop through and evaluate
8829  * for eN in range(nElements_global):
8830  * matID = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
8831  * for ii in range(nnz):
8832  * a_eN[ii] = rho*KWs[matID,ii]
8833  */
8834  __pyx_t_12 = __pyx_v_eN;
8835  __pyx_t_13 = -1;
8836  if (__pyx_t_12 < 0) {
8837  __pyx_t_12 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
8838  if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 0;
8839  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_13 = 0;
8840  if (unlikely(__pyx_t_13 != -1)) {
8841  __Pyx_RaiseBufferIndexError(__pyx_t_13);
8842  __PYX_ERR(0, 337, __pyx_L1_error)
8843  }
8844  __pyx_v_matID = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
8845 
8846  /* "subsurfaceTransportFunctions.pyx":338
8847  * for eN in range(nElements_global):
8848  * matID = elementMaterialTypes[eN]
8849  * for ii in range(nnz): # <<<<<<<<<<<<<<
8850  * a_eN[ii] = rho*KWs[matID,ii]
8851  * for ebN in range(nElementBoundaries_element):
8852  */
8853  __pyx_t_13 = __pyx_v_nnz;
8854  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
8855  __pyx_v_ii = __pyx_t_14;
8856 
8857  /* "subsurfaceTransportFunctions.pyx":339
8858  * matID = elementMaterialTypes[eN]
8859  * for ii in range(nnz):
8860  * a_eN[ii] = rho*KWs[matID,ii] # <<<<<<<<<<<<<<
8861  * for ebN in range(nElementBoundaries_element):
8862  * eN_neighbor = elementNeighborsArray[eN,ebN]
8863  */
8864  __pyx_t_15 = __pyx_v_matID;
8865  __pyx_t_16 = __pyx_v_ii;
8866  __pyx_t_17 = -1;
8867  if (__pyx_t_15 < 0) {
8868  __pyx_t_15 += __pyx_pybuffernd_KWs.diminfo[0].shape;
8869  if (unlikely(__pyx_t_15 < 0)) __pyx_t_17 = 0;
8870  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_KWs.diminfo[0].shape)) __pyx_t_17 = 0;
8871  if (__pyx_t_16 < 0) {
8872  __pyx_t_16 += __pyx_pybuffernd_KWs.diminfo[1].shape;
8873  if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 1;
8874  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_KWs.diminfo[1].shape)) __pyx_t_17 = 1;
8875  if (unlikely(__pyx_t_17 != -1)) {
8876  __Pyx_RaiseBufferIndexError(__pyx_t_17);
8877  __PYX_ERR(0, 339, __pyx_L1_error)
8878  }
8879  __pyx_t_18 = __pyx_v_ii;
8880  __pyx_t_17 = -1;
8881  if (__pyx_t_18 < 0) {
8882  __pyx_t_18 += __pyx_pybuffernd_a_eN.diminfo[0].shape;
8883  if (unlikely(__pyx_t_18 < 0)) __pyx_t_17 = 0;
8884  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_a_eN.diminfo[0].shape)) __pyx_t_17 = 0;
8885  if (unlikely(__pyx_t_17 != -1)) {
8886  __Pyx_RaiseBufferIndexError(__pyx_t_17);
8887  __PYX_ERR(0, 339, __pyx_L1_error)
8888  }
8889  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_a_eN.diminfo[0].strides) = (__pyx_v_rho * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_KWs.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_KWs.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_KWs.diminfo[1].strides)));
8890  }
8891 
8892  /* "subsurfaceTransportFunctions.pyx":340
8893  * for ii in range(nnz):
8894  * a_eN[ii] = rho*KWs[matID,ii]
8895  * for ebN in range(nElementBoundaries_element): # <<<<<<<<<<<<<<
8896  * eN_neighbor = elementNeighborsArray[eN,ebN]
8897  * for ii in range(nnz):
8898  */
8899  __pyx_t_13 = __pyx_v_nElementBoundaries_element;
8900  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
8901  __pyx_v_ebN = __pyx_t_14;
8902 
8903  /* "subsurfaceTransportFunctions.pyx":341
8904  * a_eN[ii] = rho*KWs[matID,ii]
8905  * for ebN in range(nElementBoundaries_element):
8906  * eN_neighbor = elementNeighborsArray[eN,ebN] # <<<<<<<<<<<<<<
8907  * for ii in range(nnz):
8908  * a_neig[ii] = a_eN[ii]
8909  */
8910  __pyx_t_19 = __pyx_v_eN;
8911  __pyx_t_20 = __pyx_v_ebN;
8912  __pyx_t_17 = -1;
8913  if (__pyx_t_19 < 0) {
8914  __pyx_t_19 += __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape;
8915  if (unlikely(__pyx_t_19 < 0)) __pyx_t_17 = 0;
8916  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape)) __pyx_t_17 = 0;
8917  if (__pyx_t_20 < 0) {
8918  __pyx_t_20 += __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape;
8919  if (unlikely(__pyx_t_20 < 0)) __pyx_t_17 = 1;
8920  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape)) __pyx_t_17 = 1;
8921  if (unlikely(__pyx_t_17 != -1)) {
8922  __Pyx_RaiseBufferIndexError(__pyx_t_17);
8923  __PYX_ERR(0, 341, __pyx_L1_error)
8924  }
8925  __pyx_v_eN_neighbor = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides));
8926 
8927  /* "subsurfaceTransportFunctions.pyx":342
8928  * for ebN in range(nElementBoundaries_element):
8929  * eN_neighbor = elementNeighborsArray[eN,ebN]
8930  * for ii in range(nnz): # <<<<<<<<<<<<<<
8931  * a_neig[ii] = a_eN[ii]
8932  * if eN_neighbor >= 0:
8933  */
8934  __pyx_t_17 = __pyx_v_nnz;
8935  for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_17; __pyx_t_21+=1) {
8936  __pyx_v_ii = __pyx_t_21;
8937 
8938  /* "subsurfaceTransportFunctions.pyx":343
8939  * eN_neighbor = elementNeighborsArray[eN,ebN]
8940  * for ii in range(nnz):
8941  * a_neig[ii] = a_eN[ii] # <<<<<<<<<<<<<<
8942  * if eN_neighbor >= 0:
8943  * matID_neig = elementMaterialTypes[eN_neighbor]
8944  */
8945  __pyx_t_22 = __pyx_v_ii;
8946  __pyx_t_23 = -1;
8947  if (__pyx_t_22 < 0) {
8948  __pyx_t_22 += __pyx_pybuffernd_a_eN.diminfo[0].shape;
8949  if (unlikely(__pyx_t_22 < 0)) __pyx_t_23 = 0;
8950  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_a_eN.diminfo[0].shape)) __pyx_t_23 = 0;
8951  if (unlikely(__pyx_t_23 != -1)) {
8952  __Pyx_RaiseBufferIndexError(__pyx_t_23);
8953  __PYX_ERR(0, 343, __pyx_L1_error)
8954  }
8955  __pyx_t_24 = __pyx_v_ii;
8956  __pyx_t_23 = -1;
8957  if (__pyx_t_24 < 0) {
8958  __pyx_t_24 += __pyx_pybuffernd_a_neig.diminfo[0].shape;
8959  if (unlikely(__pyx_t_24 < 0)) __pyx_t_23 = 0;
8960  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_a_neig.diminfo[0].shape)) __pyx_t_23 = 0;
8961  if (unlikely(__pyx_t_23 != -1)) {
8962  __Pyx_RaiseBufferIndexError(__pyx_t_23);
8963  __PYX_ERR(0, 343, __pyx_L1_error)
8964  }
8965  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_a_neig.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_a_eN.diminfo[0].strides));
8966  }
8967 
8968  /* "subsurfaceTransportFunctions.pyx":344
8969  * for ii in range(nnz):
8970  * a_neig[ii] = a_eN[ii]
8971  * if eN_neighbor >= 0: # <<<<<<<<<<<<<<
8972  * matID_neig = elementMaterialTypes[eN_neighbor]
8973  * for ii in range(nnz):
8974  */
8975  __pyx_t_25 = ((__pyx_v_eN_neighbor >= 0) != 0);
8976  if (__pyx_t_25) {
8977 
8978  /* "subsurfaceTransportFunctions.pyx":345
8979  * a_neig[ii] = a_eN[ii]
8980  * if eN_neighbor >= 0:
8981  * matID_neig = elementMaterialTypes[eN_neighbor] # <<<<<<<<<<<<<<
8982  * for ii in range(nnz):
8983  * a_neig[ii] = rho*KWs[matID_neig,ii]
8984  */
8985  __pyx_t_26 = __pyx_v_eN_neighbor;
8986  __pyx_t_17 = -1;
8987  if (__pyx_t_26 < 0) {
8988  __pyx_t_26 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
8989  if (unlikely(__pyx_t_26 < 0)) __pyx_t_17 = 0;
8990  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_17 = 0;
8991  if (unlikely(__pyx_t_17 != -1)) {
8992  __Pyx_RaiseBufferIndexError(__pyx_t_17);
8993  __PYX_ERR(0, 345, __pyx_L1_error)
8994  }
8995  __pyx_v_matID_neig = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
8996 
8997  /* "subsurfaceTransportFunctions.pyx":346
8998  * if eN_neighbor >= 0:
8999  * matID_neig = elementMaterialTypes[eN_neighbor]
9000  * for ii in range(nnz): # <<<<<<<<<<<<<<
9001  * a_neig[ii] = rho*KWs[matID_neig,ii]
9002  * for ii in range(nnz):
9003  */
9004  __pyx_t_17 = __pyx_v_nnz;
9005  for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_17; __pyx_t_21+=1) {
9006  __pyx_v_ii = __pyx_t_21;
9007 
9008  /* "subsurfaceTransportFunctions.pyx":347
9009  * matID_neig = elementMaterialTypes[eN_neighbor]
9010  * for ii in range(nnz):
9011  * a_neig[ii] = rho*KWs[matID_neig,ii] # <<<<<<<<<<<<<<
9012  * for ii in range(nnz):
9013  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20)
9014  */
9015  __pyx_t_27 = __pyx_v_matID_neig;
9016  __pyx_t_28 = __pyx_v_ii;
9017  __pyx_t_23 = -1;
9018  if (__pyx_t_27 < 0) {
9019  __pyx_t_27 += __pyx_pybuffernd_KWs.diminfo[0].shape;
9020  if (unlikely(__pyx_t_27 < 0)) __pyx_t_23 = 0;
9021  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_KWs.diminfo[0].shape)) __pyx_t_23 = 0;
9022  if (__pyx_t_28 < 0) {
9023  __pyx_t_28 += __pyx_pybuffernd_KWs.diminfo[1].shape;
9024  if (unlikely(__pyx_t_28 < 0)) __pyx_t_23 = 1;
9025  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_KWs.diminfo[1].shape)) __pyx_t_23 = 1;
9026  if (unlikely(__pyx_t_23 != -1)) {
9027  __Pyx_RaiseBufferIndexError(__pyx_t_23);
9028  __PYX_ERR(0, 347, __pyx_L1_error)
9029  }
9030  __pyx_t_29 = __pyx_v_ii;
9031  __pyx_t_23 = -1;
9032  if (__pyx_t_29 < 0) {
9033  __pyx_t_29 += __pyx_pybuffernd_a_neig.diminfo[0].shape;
9034  if (unlikely(__pyx_t_29 < 0)) __pyx_t_23 = 0;
9035  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_a_neig.diminfo[0].shape)) __pyx_t_23 = 0;
9036  if (unlikely(__pyx_t_23 != -1)) {
9037  __Pyx_RaiseBufferIndexError(__pyx_t_23);
9038  __PYX_ERR(0, 347, __pyx_L1_error)
9039  }
9040  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_a_neig.diminfo[0].strides) = (__pyx_v_rho * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_KWs.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_KWs.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_KWs.diminfo[1].strides)));
9041  }
9042 
9043  /* "subsurfaceTransportFunctions.pyx":344
9044  * for ii in range(nnz):
9045  * a_neig[ii] = a_eN[ii]
9046  * if eN_neighbor >= 0: # <<<<<<<<<<<<<<
9047  * matID_neig = elementMaterialTypes[eN_neighbor]
9048  * for ii in range(nnz):
9049  */
9050  }
9051 
9052  /* "subsurfaceTransportFunctions.pyx":348
9053  * for ii in range(nnz):
9054  * a_neig[ii] = rho*KWs[matID_neig,ii]
9055  * for ii in range(nnz): # <<<<<<<<<<<<<<
9056  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20)
9057  * q_alin[eN,ebN,ii] = a_avg[ii]
9058  */
9059  __pyx_t_17 = __pyx_v_nnz;
9060  for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_17; __pyx_t_21+=1) {
9061  __pyx_v_ii = __pyx_t_21;
9062 
9063  /* "subsurfaceTransportFunctions.pyx":349
9064  * a_neig[ii] = rho*KWs[matID_neig,ii]
9065  * for ii in range(nnz):
9066  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20) # <<<<<<<<<<<<<<
9067  * q_alin[eN,ebN,ii] = a_avg[ii]
9068  * for I in range(nSpace):
9069  */
9070  __pyx_t_30 = __pyx_v_ii;
9071  __pyx_t_23 = -1;
9072  if (__pyx_t_30 < 0) {
9073  __pyx_t_30 += __pyx_pybuffernd_a_eN.diminfo[0].shape;
9074  if (unlikely(__pyx_t_30 < 0)) __pyx_t_23 = 0;
9075  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_a_eN.diminfo[0].shape)) __pyx_t_23 = 0;
9076  if (unlikely(__pyx_t_23 != -1)) {
9077  __Pyx_RaiseBufferIndexError(__pyx_t_23);
9078  __PYX_ERR(0, 349, __pyx_L1_error)
9079  }
9080  __pyx_t_31 = __pyx_v_ii;
9081  __pyx_t_23 = -1;
9082  if (__pyx_t_31 < 0) {
9083  __pyx_t_31 += __pyx_pybuffernd_a_neig.diminfo[0].shape;
9084  if (unlikely(__pyx_t_31 < 0)) __pyx_t_23 = 0;
9085  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_a_neig.diminfo[0].shape)) __pyx_t_23 = 0;
9086  if (unlikely(__pyx_t_23 != -1)) {
9087  __Pyx_RaiseBufferIndexError(__pyx_t_23);
9088  __PYX_ERR(0, 349, __pyx_L1_error)
9089  }
9090  __pyx_t_32 = ((2.0 * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_a_eN.diminfo[0].strides))) * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_a_neig.diminfo[0].strides)));
9091  __pyx_t_33 = __pyx_v_ii;
9092  __pyx_t_23 = -1;
9093  if (__pyx_t_33 < 0) {
9094  __pyx_t_33 += __pyx_pybuffernd_a_eN.diminfo[0].shape;
9095  if (unlikely(__pyx_t_33 < 0)) __pyx_t_23 = 0;
9096  } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_a_eN.diminfo[0].shape)) __pyx_t_23 = 0;
9097  if (unlikely(__pyx_t_23 != -1)) {
9098  __Pyx_RaiseBufferIndexError(__pyx_t_23);
9099  __PYX_ERR(0, 349, __pyx_L1_error)
9100  }
9101  __pyx_t_34 = __pyx_v_ii;
9102  __pyx_t_23 = -1;
9103  if (__pyx_t_34 < 0) {
9104  __pyx_t_34 += __pyx_pybuffernd_a_neig.diminfo[0].shape;
9105  if (unlikely(__pyx_t_34 < 0)) __pyx_t_23 = 0;
9106  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_a_neig.diminfo[0].shape)) __pyx_t_23 = 0;
9107  if (unlikely(__pyx_t_23 != -1)) {
9108  __Pyx_RaiseBufferIndexError(__pyx_t_23);
9109  __PYX_ERR(0, 349, __pyx_L1_error)
9110  }
9111  __pyx_t_35 = (((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_a_eN.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_a_neig.diminfo[0].strides))) + 1.0e-20);
9112  if (unlikely(__pyx_t_35 == 0)) {
9113  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
9114  __PYX_ERR(0, 349, __pyx_L1_error)
9115  }
9116  __pyx_t_36 = __pyx_v_ii;
9117  __pyx_t_23 = -1;
9118  if (__pyx_t_36 < 0) {
9119  __pyx_t_36 += __pyx_pybuffernd_a_avg.diminfo[0].shape;
9120  if (unlikely(__pyx_t_36 < 0)) __pyx_t_23 = 0;
9121  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_a_avg.diminfo[0].shape)) __pyx_t_23 = 0;
9122  if (unlikely(__pyx_t_23 != -1)) {
9123  __Pyx_RaiseBufferIndexError(__pyx_t_23);
9124  __PYX_ERR(0, 349, __pyx_L1_error)
9125  }
9126  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_a_avg.diminfo[0].strides) = (__pyx_t_32 / __pyx_t_35);
9127 
9128  /* "subsurfaceTransportFunctions.pyx":350
9129  * for ii in range(nnz):
9130  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20)
9131  * q_alin[eN,ebN,ii] = a_avg[ii] # <<<<<<<<<<<<<<
9132  * for I in range(nSpace):
9133  * q_flin[eN,ebN,I] = 0.0
9134  */
9135  __pyx_t_37 = __pyx_v_ii;
9136  __pyx_t_23 = -1;
9137  if (__pyx_t_37 < 0) {
9138  __pyx_t_37 += __pyx_pybuffernd_a_avg.diminfo[0].shape;
9139  if (unlikely(__pyx_t_37 < 0)) __pyx_t_23 = 0;
9140  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_a_avg.diminfo[0].shape)) __pyx_t_23 = 0;
9141  if (unlikely(__pyx_t_23 != -1)) {
9142  __Pyx_RaiseBufferIndexError(__pyx_t_23);
9143  __PYX_ERR(0, 350, __pyx_L1_error)
9144  }
9145  __pyx_t_38 = __pyx_v_eN;
9146  __pyx_t_39 = __pyx_v_ebN;
9147  __pyx_t_40 = __pyx_v_ii;
9148  __pyx_t_23 = -1;
9149  if (__pyx_t_38 < 0) {
9150  __pyx_t_38 += __pyx_pybuffernd_q_alin.diminfo[0].shape;
9151  if (unlikely(__pyx_t_38 < 0)) __pyx_t_23 = 0;
9152  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_q_alin.diminfo[0].shape)) __pyx_t_23 = 0;
9153  if (__pyx_t_39 < 0) {
9154  __pyx_t_39 += __pyx_pybuffernd_q_alin.diminfo[1].shape;
9155  if (unlikely(__pyx_t_39 < 0)) __pyx_t_23 = 1;
9156  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_q_alin.diminfo[1].shape)) __pyx_t_23 = 1;
9157  if (__pyx_t_40 < 0) {
9158  __pyx_t_40 += __pyx_pybuffernd_q_alin.diminfo[2].shape;
9159  if (unlikely(__pyx_t_40 < 0)) __pyx_t_23 = 2;
9160  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_q_alin.diminfo[2].shape)) __pyx_t_23 = 2;
9161  if (unlikely(__pyx_t_23 != -1)) {
9162  __Pyx_RaiseBufferIndexError(__pyx_t_23);
9163  __PYX_ERR(0, 350, __pyx_L1_error)
9164  }
9165  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_q_alin.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_q_alin.diminfo[1].strides, __pyx_t_40, __pyx_pybuffernd_q_alin.diminfo[2].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_a_avg.diminfo[0].strides));
9166  }
9167 
9168  /* "subsurfaceTransportFunctions.pyx":351
9169  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20)
9170  * q_alin[eN,ebN,ii] = a_avg[ii]
9171  * for I in range(nSpace): # <<<<<<<<<<<<<<
9172  * q_flin[eN,ebN,I] = 0.0
9173  * for ii in range(rowptr[I],rowptr[I+1]):
9174  */
9175  __pyx_t_17 = __pyx_v_nSpace;
9176  for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_17; __pyx_t_21+=1) {
9177  __pyx_v_I = __pyx_t_21;
9178 
9179  /* "subsurfaceTransportFunctions.pyx":352
9180  * q_alin[eN,ebN,ii] = a_avg[ii]
9181  * for I in range(nSpace):
9182  * q_flin[eN,ebN,I] = 0.0 # <<<<<<<<<<<<<<
9183  * for ii in range(rowptr[I],rowptr[I+1]):
9184  * q_flin[eN,ebN,I] += rho*a_avg[ii]*gravity[colind[ii]]
9185  */
9186  __pyx_t_41 = __pyx_v_eN;
9187  __pyx_t_42 = __pyx_v_ebN;
9188  __pyx_t_43 = __pyx_v_I;
9189  __pyx_t_23 = -1;
9190  if (__pyx_t_41 < 0) {
9191  __pyx_t_41 += __pyx_pybuffernd_q_flin.diminfo[0].shape;
9192  if (unlikely(__pyx_t_41 < 0)) __pyx_t_23 = 0;
9193  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_q_flin.diminfo[0].shape)) __pyx_t_23 = 0;
9194  if (__pyx_t_42 < 0) {
9195  __pyx_t_42 += __pyx_pybuffernd_q_flin.diminfo[1].shape;
9196  if (unlikely(__pyx_t_42 < 0)) __pyx_t_23 = 1;
9197  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_q_flin.diminfo[1].shape)) __pyx_t_23 = 1;
9198  if (__pyx_t_43 < 0) {
9199  __pyx_t_43 += __pyx_pybuffernd_q_flin.diminfo[2].shape;
9200  if (unlikely(__pyx_t_43 < 0)) __pyx_t_23 = 2;
9201  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_q_flin.diminfo[2].shape)) __pyx_t_23 = 2;
9202  if (unlikely(__pyx_t_23 != -1)) {
9203  __Pyx_RaiseBufferIndexError(__pyx_t_23);
9204  __PYX_ERR(0, 352, __pyx_L1_error)
9205  }
9206  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_q_flin.diminfo[0].strides, __pyx_t_42, __pyx_pybuffernd_q_flin.diminfo[1].strides, __pyx_t_43, __pyx_pybuffernd_q_flin.diminfo[2].strides) = 0.0;
9207 
9208  /* "subsurfaceTransportFunctions.pyx":353
9209  * for I in range(nSpace):
9210  * q_flin[eN,ebN,I] = 0.0
9211  * for ii in range(rowptr[I],rowptr[I+1]): # <<<<<<<<<<<<<<
9212  * q_flin[eN,ebN,I] += rho*a_avg[ii]*gravity[colind[ii]]
9213  * #ebN
9214  */
9215  __pyx_t_44 = (__pyx_v_I + 1);
9216  __pyx_t_23 = -1;
9217  if (__pyx_t_44 < 0) {
9218  __pyx_t_44 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
9219  if (unlikely(__pyx_t_44 < 0)) __pyx_t_23 = 0;
9220  } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_23 = 0;
9221  if (unlikely(__pyx_t_23 != -1)) {
9222  __Pyx_RaiseBufferIndexError(__pyx_t_23);
9223  __PYX_ERR(0, 353, __pyx_L1_error)
9224  }
9225  __pyx_t_45 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_rowptr.diminfo[0].strides));
9226  __pyx_t_46 = __pyx_v_I;
9227  __pyx_t_23 = -1;
9228  if (__pyx_t_46 < 0) {
9229  __pyx_t_46 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
9230  if (unlikely(__pyx_t_46 < 0)) __pyx_t_23 = 0;
9231  } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_23 = 0;
9232  if (unlikely(__pyx_t_23 != -1)) {
9233  __Pyx_RaiseBufferIndexError(__pyx_t_23);
9234  __PYX_ERR(0, 353, __pyx_L1_error)
9235  }
9236  for (__pyx_t_23 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_rowptr.diminfo[0].strides)); __pyx_t_23 < __pyx_t_45; __pyx_t_23+=1) {
9237  __pyx_v_ii = __pyx_t_23;
9238 
9239  /* "subsurfaceTransportFunctions.pyx":354
9240  * q_flin[eN,ebN,I] = 0.0
9241  * for ii in range(rowptr[I],rowptr[I+1]):
9242  * q_flin[eN,ebN,I] += rho*a_avg[ii]*gravity[colind[ii]] # <<<<<<<<<<<<<<
9243  * #ebN
9244  * #eN
9245  */
9246  __pyx_t_47 = __pyx_v_ii;
9247  __pyx_t_48 = -1;
9248  if (__pyx_t_47 < 0) {
9249  __pyx_t_47 += __pyx_pybuffernd_a_avg.diminfo[0].shape;
9250  if (unlikely(__pyx_t_47 < 0)) __pyx_t_48 = 0;
9251  } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_a_avg.diminfo[0].shape)) __pyx_t_48 = 0;
9252  if (unlikely(__pyx_t_48 != -1)) {
9253  __Pyx_RaiseBufferIndexError(__pyx_t_48);
9254  __PYX_ERR(0, 354, __pyx_L1_error)
9255  }
9256  __pyx_t_49 = __pyx_v_ii;
9257  __pyx_t_48 = -1;
9258  if (__pyx_t_49 < 0) {
9259  __pyx_t_49 += __pyx_pybuffernd_colind.diminfo[0].shape;
9260  if (unlikely(__pyx_t_49 < 0)) __pyx_t_48 = 0;
9261  } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_colind.diminfo[0].shape)) __pyx_t_48 = 0;
9262  if (unlikely(__pyx_t_48 != -1)) {
9263  __Pyx_RaiseBufferIndexError(__pyx_t_48);
9264  __PYX_ERR(0, 354, __pyx_L1_error)
9265  }
9266  __pyx_t_50 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_colind.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_colind.diminfo[0].strides));
9267  __pyx_t_48 = -1;
9268  if (__pyx_t_50 < 0) {
9269  __pyx_t_50 += __pyx_pybuffernd_gravity.diminfo[0].shape;
9270  if (unlikely(__pyx_t_50 < 0)) __pyx_t_48 = 0;
9271  } else if (unlikely(__pyx_t_50 >= __pyx_pybuffernd_gravity.diminfo[0].shape)) __pyx_t_48 = 0;
9272  if (unlikely(__pyx_t_48 != -1)) {
9273  __Pyx_RaiseBufferIndexError(__pyx_t_48);
9274  __PYX_ERR(0, 354, __pyx_L1_error)
9275  }
9276  __pyx_t_51 = __pyx_v_eN;
9277  __pyx_t_52 = __pyx_v_ebN;
9278  __pyx_t_53 = __pyx_v_I;
9279  __pyx_t_48 = -1;
9280  if (__pyx_t_51 < 0) {
9281  __pyx_t_51 += __pyx_pybuffernd_q_flin.diminfo[0].shape;
9282  if (unlikely(__pyx_t_51 < 0)) __pyx_t_48 = 0;
9283  } else if (unlikely(__pyx_t_51 >= __pyx_pybuffernd_q_flin.diminfo[0].shape)) __pyx_t_48 = 0;
9284  if (__pyx_t_52 < 0) {
9285  __pyx_t_52 += __pyx_pybuffernd_q_flin.diminfo[1].shape;
9286  if (unlikely(__pyx_t_52 < 0)) __pyx_t_48 = 1;
9287  } else if (unlikely(__pyx_t_52 >= __pyx_pybuffernd_q_flin.diminfo[1].shape)) __pyx_t_48 = 1;
9288  if (__pyx_t_53 < 0) {
9289  __pyx_t_53 += __pyx_pybuffernd_q_flin.diminfo[2].shape;
9290  if (unlikely(__pyx_t_53 < 0)) __pyx_t_48 = 2;
9291  } else if (unlikely(__pyx_t_53 >= __pyx_pybuffernd_q_flin.diminfo[2].shape)) __pyx_t_48 = 2;
9292  if (unlikely(__pyx_t_48 != -1)) {
9293  __Pyx_RaiseBufferIndexError(__pyx_t_48);
9294  __PYX_ERR(0, 354, __pyx_L1_error)
9295  }
9296  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_q_flin.diminfo[0].strides, __pyx_t_52, __pyx_pybuffernd_q_flin.diminfo[1].strides, __pyx_t_53, __pyx_pybuffernd_q_flin.diminfo[2].strides) += ((__pyx_v_rho * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_a_avg.diminfo[0].strides))) * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_gravity.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_gravity.diminfo[0].strides)));
9297  }
9298  }
9299  }
9300  }
9301 
9302  /* "subsurfaceTransportFunctions.pyx":301
9303  *
9304  * ##################################################
9305  * def RE_NCP1_evaluateElementCoefficients_Linear(double rho, # <<<<<<<<<<<<<<
9306  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
9307  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
9308  */
9309 
9310  /* function exit code */
9311  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9312  goto __pyx_L0;
9313  __pyx_L1_error:;
9314  __Pyx_XDECREF(__pyx_t_3);
9315  __Pyx_XDECREF(__pyx_t_4);
9316  __Pyx_XDECREF(__pyx_t_5);
9317  __Pyx_XDECREF(__pyx_t_6);
9318  __Pyx_XDECREF(__pyx_t_7);
9319  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
9320  __Pyx_PyThreadState_declare
9321  __Pyx_PyThreadState_assign
9322  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
9323  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_KWs.rcbuffer->pybuffer);
9324  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_avg.rcbuffer->pybuffer);
9325  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_eN.rcbuffer->pybuffer);
9326  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_neig.rcbuffer->pybuffer);
9327  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
9328  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
9329  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
9330  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
9331  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
9332  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
9333  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
9334  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
9335  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_evaluateElementCoefficients_Linear", __pyx_clineno, __pyx_lineno, __pyx_filename);
9336  __pyx_r = NULL;
9337  goto __pyx_L2;
9338  __pyx_L0:;
9339  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_KWs.rcbuffer->pybuffer);
9340  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_avg.rcbuffer->pybuffer);
9341  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_eN.rcbuffer->pybuffer);
9342  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_neig.rcbuffer->pybuffer);
9343  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
9344  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
9345  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
9346  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
9347  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
9348  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
9349  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
9350  __pyx_L2:;
9351  __Pyx_XDECREF((PyObject *)__pyx_v_a_eN);
9352  __Pyx_XDECREF((PyObject *)__pyx_v_a_neig);
9353  __Pyx_XDECREF((PyObject *)__pyx_v_a_avg);
9354  __Pyx_XGIVEREF(__pyx_r);
9355  __Pyx_RefNannyFinishContext();
9356  return __pyx_r;
9357 }
9358 
9359 /* "subsurfaceTransportFunctions.pyx":359
9360  *
9361  *
9362  * def RE_NCP1_evaluateElementCoefficients_VGM(double rho, # <<<<<<<<<<<<<<
9363  * double beta,
9364  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
9365  */
9366 
9367 /* Python wrapper */
9368 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
9369 static char __pyx_doc_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM[] = "\n routine for evaluating nodal coefficients in NCP1 approximation for conservative head formulation of Richards equation \n\n Approximation:\n uses nodal quadrature where the nodes are face barycenters\n uses harmonic average for intrinsic permeability/ hydraulic conductivity\n assumes slight compressiblity for now\n\n TODO:\n everything\n \n ";
9370 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM = {"RE_NCP1_evaluateElementCoefficients_VGM", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM};
9371 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9372  double __pyx_v_rho;
9373  double __pyx_v_beta;
9374  PyArrayObject *__pyx_v_gravity = 0;
9375  PyArrayObject *__pyx_v_alpha = 0;
9376  PyArrayObject *__pyx_v_n = 0;
9377  PyArrayObject *__pyx_v_thetaR = 0;
9378  PyArrayObject *__pyx_v_thetaSR = 0;
9379  int __pyx_v_nSpace;
9380  int __pyx_v_nElements_global;
9381  int __pyx_v_nElementBoundaries_element;
9382  PyArrayObject *__pyx_v_elementNeighborsArray = 0;
9383  PyArrayObject *__pyx_v_elementBarycentersArray = 0;
9384  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
9385  int __pyx_v_nDOF_trial_element;
9386  PyArrayObject *__pyx_v_u_l2g = 0;
9387  PyArrayObject *__pyx_v_u_dof = 0;
9388  CYTHON_UNUSED PyArrayObject *__pyx_v_q_x = 0;
9389  PyArrayObject *__pyx_v_q_u = 0;
9390  PyArrayObject *__pyx_v_q_mass = 0;
9391  PyArrayObject *__pyx_v_q_dmass = 0;
9392  PyArrayObject *__pyx_v_q_r = 0;
9393  PyArrayObject *__pyx_v_q_kr = 0;
9394  PyArrayObject *__pyx_v_q_dkr = 0;
9395  PyArrayObject *__pyx_v_q_kr_up = 0;
9396  PyObject *__pyx_r = 0;
9397  __Pyx_RefNannyDeclarations
9398  __Pyx_RefNannySetupContext("RE_NCP1_evaluateElementCoefficients_VGM (wrapper)", 0);
9399  {
9400  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rho,&__pyx_n_s_beta,&__pyx_n_s_gravity,&__pyx_n_s_alpha,&__pyx_n_s_n,&__pyx_n_s_thetaR,&__pyx_n_s_thetaSR,&__pyx_n_s_nSpace,&__pyx_n_s_nElements_global,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_nDOF_trial_element,&__pyx_n_s_u_l2g,&__pyx_n_s_u_dof,&__pyx_n_s_q_x,&__pyx_n_s_q_u,&__pyx_n_s_q_mass,&__pyx_n_s_q_dmass,&__pyx_n_s_q_r,&__pyx_n_s_q_kr,&__pyx_n_s_q_dkr,&__pyx_n_s_q_kr_up,0};
9401  PyObject* values[24] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
9402  if (unlikely(__pyx_kwds)) {
9403  Py_ssize_t kw_args;
9404  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9405  switch (pos_args) {
9406  case 24: values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
9407  case 23: values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
9408  case 22: values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
9409  case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
9410  case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
9411  case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
9412  case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
9413  case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
9414  case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
9415  case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
9416  case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
9417  case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
9418  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
9419  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
9420  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
9421  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
9422  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
9423  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
9424  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
9425  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
9426  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
9427  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9428  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9429  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9430  case 0: break;
9431  default: goto __pyx_L5_argtuple_error;
9432  }
9433  kw_args = PyDict_Size(__pyx_kwds);
9434  switch (pos_args) {
9435  case 0:
9436  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rho)) != 0)) kw_args--;
9437  else goto __pyx_L5_argtuple_error;
9438  case 1:
9439  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
9440  else {
9441  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 1); __PYX_ERR(0, 359, __pyx_L3_error)
9442  }
9443  case 2:
9444  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--;
9445  else {
9446  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 2); __PYX_ERR(0, 359, __pyx_L3_error)
9447  }
9448  case 3:
9449  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
9450  else {
9451  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 3); __PYX_ERR(0, 359, __pyx_L3_error)
9452  }
9453  case 4:
9454  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
9455  else {
9456  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 4); __PYX_ERR(0, 359, __pyx_L3_error)
9457  }
9458  case 5:
9459  if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_thetaR)) != 0)) kw_args--;
9460  else {
9461  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 5); __PYX_ERR(0, 359, __pyx_L3_error)
9462  }
9463  case 6:
9464  if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_thetaSR)) != 0)) kw_args--;
9465  else {
9466  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 6); __PYX_ERR(0, 359, __pyx_L3_error)
9467  }
9468  case 7:
9469  if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nSpace)) != 0)) kw_args--;
9470  else {
9471  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 7); __PYX_ERR(0, 359, __pyx_L3_error)
9472  }
9473  case 8:
9474  if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
9475  else {
9476  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 8); __PYX_ERR(0, 359, __pyx_L3_error)
9477  }
9478  case 9:
9479  if (likely((values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
9480  else {
9481  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 9); __PYX_ERR(0, 359, __pyx_L3_error)
9482  }
9483  case 10:
9484  if (likely((values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
9485  else {
9486  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 10); __PYX_ERR(0, 359, __pyx_L3_error)
9487  }
9488  case 11:
9489  if (likely((values[11] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
9490  else {
9491  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 11); __PYX_ERR(0, 359, __pyx_L3_error)
9492  }
9493  case 12:
9494  if (likely((values[12] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
9495  else {
9496  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 12); __PYX_ERR(0, 359, __pyx_L3_error)
9497  }
9498  case 13:
9499  if (likely((values[13] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nDOF_trial_element)) != 0)) kw_args--;
9500  else {
9501  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 13); __PYX_ERR(0, 359, __pyx_L3_error)
9502  }
9503  case 14:
9504  if (likely((values[14] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_u_l2g)) != 0)) kw_args--;
9505  else {
9506  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 14); __PYX_ERR(0, 359, __pyx_L3_error)
9507  }
9508  case 15:
9509  if (likely((values[15] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_u_dof)) != 0)) kw_args--;
9510  else {
9511  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 15); __PYX_ERR(0, 359, __pyx_L3_error)
9512  }
9513  case 16:
9514  if (likely((values[16] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_x)) != 0)) kw_args--;
9515  else {
9516  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 16); __PYX_ERR(0, 359, __pyx_L3_error)
9517  }
9518  case 17:
9519  if (likely((values[17] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_u)) != 0)) kw_args--;
9520  else {
9521  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 17); __PYX_ERR(0, 359, __pyx_L3_error)
9522  }
9523  case 18:
9524  if (likely((values[18] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_mass)) != 0)) kw_args--;
9525  else {
9526  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 18); __PYX_ERR(0, 359, __pyx_L3_error)
9527  }
9528  case 19:
9529  if (likely((values[19] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_dmass)) != 0)) kw_args--;
9530  else {
9531  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 19); __PYX_ERR(0, 359, __pyx_L3_error)
9532  }
9533  case 20:
9534  if (likely((values[20] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_r)) != 0)) kw_args--;
9535  else {
9536  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 20); __PYX_ERR(0, 359, __pyx_L3_error)
9537  }
9538  case 21:
9539  if (likely((values[21] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_kr)) != 0)) kw_args--;
9540  else {
9541  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 21); __PYX_ERR(0, 359, __pyx_L3_error)
9542  }
9543  case 22:
9544  if (likely((values[22] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_dkr)) != 0)) kw_args--;
9545  else {
9546  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 22); __PYX_ERR(0, 359, __pyx_L3_error)
9547  }
9548  case 23:
9549  if (likely((values[23] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_kr_up)) != 0)) kw_args--;
9550  else {
9551  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 23); __PYX_ERR(0, 359, __pyx_L3_error)
9552  }
9553  }
9554  if (unlikely(kw_args > 0)) {
9555  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RE_NCP1_evaluateElementCoefficients_VGM") < 0)) __PYX_ERR(0, 359, __pyx_L3_error)
9556  }
9557  } else if (PyTuple_GET_SIZE(__pyx_args) != 24) {
9558  goto __pyx_L5_argtuple_error;
9559  } else {
9560  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9561  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9562  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9563  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
9564  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
9565  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
9566  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
9567  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
9568  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
9569  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
9570  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
9571  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
9572  values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
9573  values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
9574  values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
9575  values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
9576  values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
9577  values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
9578  values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
9579  values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
9580  values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
9581  values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
9582  values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
9583  values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
9584  }
9585  __pyx_v_rho = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_rho == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 359, __pyx_L3_error)
9586  __pyx_v_beta = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 360, __pyx_L3_error)
9587  __pyx_v_gravity = ((PyArrayObject *)values[2]);
9588  __pyx_v_alpha = ((PyArrayObject *)values[3]);
9589  __pyx_v_n = ((PyArrayObject *)values[4]);
9590  __pyx_v_thetaR = ((PyArrayObject *)values[5]);
9591  __pyx_v_thetaSR = ((PyArrayObject *)values[6]);
9592  __pyx_v_nSpace = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_nSpace == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 367, __pyx_L3_error)
9593  __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_nElements_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 368, __pyx_L3_error)
9594  __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_nElementBoundaries_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 369, __pyx_L3_error)
9595  __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[10]);
9596  __pyx_v_elementBarycentersArray = ((PyArrayObject *)values[11]);
9597  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[12]);
9598  __pyx_v_nDOF_trial_element = __Pyx_PyInt_As_int(values[13]); if (unlikely((__pyx_v_nDOF_trial_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 374, __pyx_L3_error)
9599  __pyx_v_u_l2g = ((PyArrayObject *)values[14]);
9600  __pyx_v_u_dof = ((PyArrayObject *)values[15]);
9601  __pyx_v_q_x = ((PyArrayObject *)values[16]);
9602  __pyx_v_q_u = ((PyArrayObject *)values[17]);
9603  __pyx_v_q_mass = ((PyArrayObject *)values[18]);
9604  __pyx_v_q_dmass = ((PyArrayObject *)values[19]);
9605  __pyx_v_q_r = ((PyArrayObject *)values[20]);
9606  __pyx_v_q_kr = ((PyArrayObject *)values[21]);
9607  __pyx_v_q_dkr = ((PyArrayObject *)values[22]);
9608  __pyx_v_q_kr_up = ((PyArrayObject *)values[23]);
9609  }
9610  goto __pyx_L4_argument_unpacking_done;
9611  __pyx_L5_argtuple_error:;
9612  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 359, __pyx_L3_error)
9613  __pyx_L3_error:;
9614  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_evaluateElementCoefficients_VGM", __pyx_clineno, __pyx_lineno, __pyx_filename);
9615  __Pyx_RefNannyFinishContext();
9616  return NULL;
9617  __pyx_L4_argument_unpacking_done:;
9618  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gravity), __pyx_ptype_5numpy_ndarray, 1, "gravity", 0))) __PYX_ERR(0, 361, __pyx_L1_error)
9619  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_alpha), __pyx_ptype_5numpy_ndarray, 1, "alpha", 0))) __PYX_ERR(0, 362, __pyx_L1_error)
9620  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_n), __pyx_ptype_5numpy_ndarray, 1, "n", 0))) __PYX_ERR(0, 363, __pyx_L1_error)
9621  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thetaR), __pyx_ptype_5numpy_ndarray, 1, "thetaR", 0))) __PYX_ERR(0, 364, __pyx_L1_error)
9622  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thetaSR), __pyx_ptype_5numpy_ndarray, 1, "thetaSR", 0))) __PYX_ERR(0, 365, __pyx_L1_error)
9623  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1, "elementNeighborsArray", 0))) __PYX_ERR(0, 370, __pyx_L1_error)
9624  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_ptype_5numpy_ndarray, 1, "elementBarycentersArray", 0))) __PYX_ERR(0, 371, __pyx_L1_error)
9625  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 372, __pyx_L1_error)
9626  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_u_l2g), __pyx_ptype_5numpy_ndarray, 1, "u_l2g", 0))) __PYX_ERR(0, 375, __pyx_L1_error)
9627  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_u_dof), __pyx_ptype_5numpy_ndarray, 1, "u_dof", 0))) __PYX_ERR(0, 376, __pyx_L1_error)
9628  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_x), __pyx_ptype_5numpy_ndarray, 1, "q_x", 0))) __PYX_ERR(0, 378, __pyx_L1_error)
9629  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_u), __pyx_ptype_5numpy_ndarray, 1, "q_u", 0))) __PYX_ERR(0, 379, __pyx_L1_error)
9630  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_mass), __pyx_ptype_5numpy_ndarray, 1, "q_mass", 0))) __PYX_ERR(0, 380, __pyx_L1_error)
9631  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dmass), __pyx_ptype_5numpy_ndarray, 1, "q_dmass", 0))) __PYX_ERR(0, 381, __pyx_L1_error)
9632  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_r), __pyx_ptype_5numpy_ndarray, 1, "q_r", 0))) __PYX_ERR(0, 382, __pyx_L1_error)
9633  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr), __pyx_ptype_5numpy_ndarray, 1, "q_kr", 0))) __PYX_ERR(0, 383, __pyx_L1_error)
9634  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dkr), __pyx_ptype_5numpy_ndarray, 1, "q_dkr", 0))) __PYX_ERR(0, 384, __pyx_L1_error)
9635  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr_up), __pyx_ptype_5numpy_ndarray, 1, "q_kr_up", 0))) __PYX_ERR(0, 385, __pyx_L1_error)
9636  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM(__pyx_self, __pyx_v_rho, __pyx_v_beta, __pyx_v_gravity, __pyx_v_alpha, __pyx_v_n, __pyx_v_thetaR, __pyx_v_thetaSR, __pyx_v_nSpace, __pyx_v_nElements_global, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_elementBarycentersArray, __pyx_v_elementMaterialTypes, __pyx_v_nDOF_trial_element, __pyx_v_u_l2g, __pyx_v_u_dof, __pyx_v_q_x, __pyx_v_q_u, __pyx_v_q_mass, __pyx_v_q_dmass, __pyx_v_q_r, __pyx_v_q_kr, __pyx_v_q_dkr, __pyx_v_q_kr_up);
9637 
9638  /* function exit code */
9639  goto __pyx_L0;
9640  __pyx_L1_error:;
9641  __pyx_r = NULL;
9642  __pyx_L0:;
9643  __Pyx_RefNannyFinishContext();
9644  return __pyx_r;
9645 }
9646 
9647 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rho, double __pyx_v_beta, PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_alpha, PyArrayObject *__pyx_v_n, PyArrayObject *__pyx_v_thetaR, PyArrayObject *__pyx_v_thetaSR, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray, PyArrayObject *__pyx_v_elementBarycentersArray, PyArrayObject *__pyx_v_elementMaterialTypes, int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_u_l2g, PyArrayObject *__pyx_v_u_dof, CYTHON_UNUSED PyArrayObject *__pyx_v_q_x, PyArrayObject *__pyx_v_q_u, PyArrayObject *__pyx_v_q_mass, PyArrayObject *__pyx_v_q_dmass, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, PyArrayObject *__pyx_v_q_dkr, PyArrayObject *__pyx_v_q_kr_up) {
9648  PyObject *__pyx_v_q = NULL;
9649  double __pyx_v_psiC;
9650  double __pyx_v_pcBar;
9651  double __pyx_v_pcBar_n;
9652  double __pyx_v_pcBar_nM1;
9653  double __pyx_v_pcBar_nM2;
9654  double __pyx_v_onePlus_pcBar_n;
9655  double __pyx_v_sBar;
9656  double __pyx_v_sqrt_sBar;
9657  double __pyx_v_DsBar_DpsiC;
9658  double __pyx_v_thetaW;
9659  double __pyx_v_DthetaW_DpsiC;
9660  double __pyx_v_vBar;
9661  double __pyx_v_vBar2;
9662  double __pyx_v_DvBar_DpsiC;
9663  double __pyx_v_KWr;
9664  double __pyx_v_DKWr_DpsiC;
9665  CYTHON_UNUSED double __pyx_v_rho2;
9666  double __pyx_v_thetaS;
9667  double __pyx_v_rhom;
9668  double __pyx_v_drhom;
9669  double __pyx_v_m;
9670  double __pyx_v_u_j;
9671  double __pyx_v_u_eN;
9672  double __pyx_v_u_neig;
9673  double __pyx_v_kr_eN;
9674  double __pyx_v_kr_neig;
9675  double __pyx_v_phi_eN;
9676  double __pyx_v_phi_neig;
9677  int __pyx_v_eN;
9678  int __pyx_v_eN_neighbor;
9679  int __pyx_v_ebN;
9680  int __pyx_v_j;
9681  int __pyx_v_matID;
9682  double __pyx_v_nAvgWeight;
9683  __Pyx_LocalBuf_ND __pyx_pybuffernd_alpha;
9684  __Pyx_Buffer __pyx_pybuffer_alpha;
9685  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBarycentersArray;
9686  __Pyx_Buffer __pyx_pybuffer_elementBarycentersArray;
9687  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
9688  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
9689  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementNeighborsArray;
9690  __Pyx_Buffer __pyx_pybuffer_elementNeighborsArray;
9691  __Pyx_LocalBuf_ND __pyx_pybuffernd_gravity;
9692  __Pyx_Buffer __pyx_pybuffer_gravity;
9693  __Pyx_LocalBuf_ND __pyx_pybuffernd_n;
9694  __Pyx_Buffer __pyx_pybuffer_n;
9695  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dkr;
9696  __Pyx_Buffer __pyx_pybuffer_q_dkr;
9697  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dmass;
9698  __Pyx_Buffer __pyx_pybuffer_q_dmass;
9699  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr;
9700  __Pyx_Buffer __pyx_pybuffer_q_kr;
9701  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr_up;
9702  __Pyx_Buffer __pyx_pybuffer_q_kr_up;
9703  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_mass;
9704  __Pyx_Buffer __pyx_pybuffer_q_mass;
9705  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_r;
9706  __Pyx_Buffer __pyx_pybuffer_q_r;
9707  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_u;
9708  __Pyx_Buffer __pyx_pybuffer_q_u;
9709  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_x;
9710  __Pyx_Buffer __pyx_pybuffer_q_x;
9711  __Pyx_LocalBuf_ND __pyx_pybuffernd_thetaR;
9712  __Pyx_Buffer __pyx_pybuffer_thetaR;
9713  __Pyx_LocalBuf_ND __pyx_pybuffernd_thetaSR;
9714  __Pyx_Buffer __pyx_pybuffer_thetaSR;
9715  __Pyx_LocalBuf_ND __pyx_pybuffernd_u_dof;
9716  __Pyx_Buffer __pyx_pybuffer_u_dof;
9717  __Pyx_LocalBuf_ND __pyx_pybuffernd_u_l2g;
9718  __Pyx_Buffer __pyx_pybuffer_u_l2g;
9719  PyObject *__pyx_r = NULL;
9720  __Pyx_RefNannyDeclarations
9721  PyObject *__pyx_t_1 = NULL;
9722  PyObject *__pyx_t_2 = NULL;
9723  Py_ssize_t __pyx_t_3;
9724  PyObject *__pyx_t_4 = NULL;
9725  PyObject *__pyx_t_5 = NULL;
9726  int __pyx_t_6;
9727  double __pyx_t_7;
9728  int __pyx_t_8;
9729  int __pyx_t_9;
9730  Py_ssize_t __pyx_t_10;
9731  int __pyx_t_11;
9732  int __pyx_t_12;
9733  Py_ssize_t __pyx_t_13;
9734  Py_ssize_t __pyx_t_14;
9735  int __pyx_t_15;
9736  Py_ssize_t __pyx_t_16;
9737  Py_ssize_t __pyx_t_17;
9738  Py_ssize_t __pyx_t_18;
9739  Py_ssize_t __pyx_t_19;
9740  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_20;
9741  Py_ssize_t __pyx_t_21;
9742  Py_ssize_t __pyx_t_22;
9743  Py_ssize_t __pyx_t_23;
9744  Py_ssize_t __pyx_t_24;
9745  Py_ssize_t __pyx_t_25;
9746  Py_ssize_t __pyx_t_26;
9747  Py_ssize_t __pyx_t_27;
9748  Py_ssize_t __pyx_t_28;
9749  Py_ssize_t __pyx_t_29;
9750  Py_ssize_t __pyx_t_30;
9751  Py_ssize_t __pyx_t_31;
9752  Py_ssize_t __pyx_t_32;
9753  Py_ssize_t __pyx_t_33;
9754  Py_ssize_t __pyx_t_34;
9755  Py_ssize_t __pyx_t_35;
9756  Py_ssize_t __pyx_t_36;
9757  Py_ssize_t __pyx_t_37;
9758  Py_ssize_t __pyx_t_38;
9759  Py_ssize_t __pyx_t_39;
9760  PyObject *__pyx_t_40 = NULL;
9761  PyObject *__pyx_t_41 = NULL;
9762  Py_ssize_t __pyx_t_42;
9763  Py_ssize_t __pyx_t_43;
9764  Py_ssize_t __pyx_t_44;
9765  Py_ssize_t __pyx_t_45;
9766  Py_ssize_t __pyx_t_46;
9767  Py_ssize_t __pyx_t_47;
9768  __Pyx_RefNannySetupContext("RE_NCP1_evaluateElementCoefficients_VGM", 0);
9769  __pyx_pybuffer_gravity.pybuffer.buf = NULL;
9770  __pyx_pybuffer_gravity.refcount = 0;
9771  __pyx_pybuffernd_gravity.data = NULL;
9772  __pyx_pybuffernd_gravity.rcbuffer = &__pyx_pybuffer_gravity;
9773  __pyx_pybuffer_alpha.pybuffer.buf = NULL;
9774  __pyx_pybuffer_alpha.refcount = 0;
9775  __pyx_pybuffernd_alpha.data = NULL;
9776  __pyx_pybuffernd_alpha.rcbuffer = &__pyx_pybuffer_alpha;
9777  __pyx_pybuffer_n.pybuffer.buf = NULL;
9778  __pyx_pybuffer_n.refcount = 0;
9779  __pyx_pybuffernd_n.data = NULL;
9780  __pyx_pybuffernd_n.rcbuffer = &__pyx_pybuffer_n;
9781  __pyx_pybuffer_thetaR.pybuffer.buf = NULL;
9782  __pyx_pybuffer_thetaR.refcount = 0;
9783  __pyx_pybuffernd_thetaR.data = NULL;
9784  __pyx_pybuffernd_thetaR.rcbuffer = &__pyx_pybuffer_thetaR;
9785  __pyx_pybuffer_thetaSR.pybuffer.buf = NULL;
9786  __pyx_pybuffer_thetaSR.refcount = 0;
9787  __pyx_pybuffernd_thetaSR.data = NULL;
9788  __pyx_pybuffernd_thetaSR.rcbuffer = &__pyx_pybuffer_thetaSR;
9789  __pyx_pybuffer_elementNeighborsArray.pybuffer.buf = NULL;
9790  __pyx_pybuffer_elementNeighborsArray.refcount = 0;
9791  __pyx_pybuffernd_elementNeighborsArray.data = NULL;
9792  __pyx_pybuffernd_elementNeighborsArray.rcbuffer = &__pyx_pybuffer_elementNeighborsArray;
9793  __pyx_pybuffer_elementBarycentersArray.pybuffer.buf = NULL;
9794  __pyx_pybuffer_elementBarycentersArray.refcount = 0;
9795  __pyx_pybuffernd_elementBarycentersArray.data = NULL;
9796  __pyx_pybuffernd_elementBarycentersArray.rcbuffer = &__pyx_pybuffer_elementBarycentersArray;
9797  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
9798  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
9799  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
9800  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
9801  __pyx_pybuffer_u_l2g.pybuffer.buf = NULL;
9802  __pyx_pybuffer_u_l2g.refcount = 0;
9803  __pyx_pybuffernd_u_l2g.data = NULL;
9804  __pyx_pybuffernd_u_l2g.rcbuffer = &__pyx_pybuffer_u_l2g;
9805  __pyx_pybuffer_u_dof.pybuffer.buf = NULL;
9806  __pyx_pybuffer_u_dof.refcount = 0;
9807  __pyx_pybuffernd_u_dof.data = NULL;
9808  __pyx_pybuffernd_u_dof.rcbuffer = &__pyx_pybuffer_u_dof;
9809  __pyx_pybuffer_q_x.pybuffer.buf = NULL;
9810  __pyx_pybuffer_q_x.refcount = 0;
9811  __pyx_pybuffernd_q_x.data = NULL;
9812  __pyx_pybuffernd_q_x.rcbuffer = &__pyx_pybuffer_q_x;
9813  __pyx_pybuffer_q_u.pybuffer.buf = NULL;
9814  __pyx_pybuffer_q_u.refcount = 0;
9815  __pyx_pybuffernd_q_u.data = NULL;
9816  __pyx_pybuffernd_q_u.rcbuffer = &__pyx_pybuffer_q_u;
9817  __pyx_pybuffer_q_mass.pybuffer.buf = NULL;
9818  __pyx_pybuffer_q_mass.refcount = 0;
9819  __pyx_pybuffernd_q_mass.data = NULL;
9820  __pyx_pybuffernd_q_mass.rcbuffer = &__pyx_pybuffer_q_mass;
9821  __pyx_pybuffer_q_dmass.pybuffer.buf = NULL;
9822  __pyx_pybuffer_q_dmass.refcount = 0;
9823  __pyx_pybuffernd_q_dmass.data = NULL;
9824  __pyx_pybuffernd_q_dmass.rcbuffer = &__pyx_pybuffer_q_dmass;
9825  __pyx_pybuffer_q_r.pybuffer.buf = NULL;
9826  __pyx_pybuffer_q_r.refcount = 0;
9827  __pyx_pybuffernd_q_r.data = NULL;
9828  __pyx_pybuffernd_q_r.rcbuffer = &__pyx_pybuffer_q_r;
9829  __pyx_pybuffer_q_kr.pybuffer.buf = NULL;
9830  __pyx_pybuffer_q_kr.refcount = 0;
9831  __pyx_pybuffernd_q_kr.data = NULL;
9832  __pyx_pybuffernd_q_kr.rcbuffer = &__pyx_pybuffer_q_kr;
9833  __pyx_pybuffer_q_dkr.pybuffer.buf = NULL;
9834  __pyx_pybuffer_q_dkr.refcount = 0;
9835  __pyx_pybuffernd_q_dkr.data = NULL;
9836  __pyx_pybuffernd_q_dkr.rcbuffer = &__pyx_pybuffer_q_dkr;
9837  __pyx_pybuffer_q_kr_up.pybuffer.buf = NULL;
9838  __pyx_pybuffer_q_kr_up.refcount = 0;
9839  __pyx_pybuffernd_q_kr_up.data = NULL;
9840  __pyx_pybuffernd_q_kr_up.rcbuffer = &__pyx_pybuffer_q_kr_up;
9841  {
9842  __Pyx_BufFmt_StackElem __pyx_stack[1];
9843  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer, (PyObject*)__pyx_v_gravity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
9844  }
9845  __pyx_pybuffernd_gravity.diminfo[0].strides = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gravity.diminfo[0].shape = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.shape[0];
9846  {
9847  __Pyx_BufFmt_StackElem __pyx_stack[1];
9848  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alpha.rcbuffer->pybuffer, (PyObject*)__pyx_v_alpha, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
9849  }
9850  __pyx_pybuffernd_alpha.diminfo[0].strides = __pyx_pybuffernd_alpha.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_alpha.diminfo[0].shape = __pyx_pybuffernd_alpha.rcbuffer->pybuffer.shape[0];
9851  {
9852  __Pyx_BufFmt_StackElem __pyx_stack[1];
9853  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_n, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
9854  }
9855  __pyx_pybuffernd_n.diminfo[0].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_n.diminfo[0].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[0];
9856  {
9857  __Pyx_BufFmt_StackElem __pyx_stack[1];
9858  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_thetaR.rcbuffer->pybuffer, (PyObject*)__pyx_v_thetaR, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
9859  }
9860  __pyx_pybuffernd_thetaR.diminfo[0].strides = __pyx_pybuffernd_thetaR.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_thetaR.diminfo[0].shape = __pyx_pybuffernd_thetaR.rcbuffer->pybuffer.shape[0];
9861  {
9862  __Pyx_BufFmt_StackElem __pyx_stack[1];
9863  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_thetaSR.rcbuffer->pybuffer, (PyObject*)__pyx_v_thetaSR, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
9864  }
9865  __pyx_pybuffernd_thetaSR.diminfo[0].strides = __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_thetaSR.diminfo[0].shape = __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.shape[0];
9866  {
9867  __Pyx_BufFmt_StackElem __pyx_stack[1];
9868  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementNeighborsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
9869  }
9870  __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[1];
9871  {
9872  __Pyx_BufFmt_StackElem __pyx_stack[1];
9873  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBarycentersArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
9874  }
9875  __pyx_pybuffernd_elementBarycentersArray.diminfo[0].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[0].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[1];
9876  {
9877  __Pyx_BufFmt_StackElem __pyx_stack[1];
9878  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
9879  }
9880  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
9881  {
9882  __Pyx_BufFmt_StackElem __pyx_stack[1];
9883  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_u_l2g.rcbuffer->pybuffer, (PyObject*)__pyx_v_u_l2g, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
9884  }
9885  __pyx_pybuffernd_u_l2g.diminfo[0].strides = __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_u_l2g.diminfo[0].shape = __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_u_l2g.diminfo[1].strides = __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_u_l2g.diminfo[1].shape = __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.shape[1];
9886  {
9887  __Pyx_BufFmt_StackElem __pyx_stack[1];
9888  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_u_dof.rcbuffer->pybuffer, (PyObject*)__pyx_v_u_dof, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
9889  }
9890  __pyx_pybuffernd_u_dof.diminfo[0].strides = __pyx_pybuffernd_u_dof.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_u_dof.diminfo[0].shape = __pyx_pybuffernd_u_dof.rcbuffer->pybuffer.shape[0];
9891  {
9892  __Pyx_BufFmt_StackElem __pyx_stack[1];
9893  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
9894  }
9895  __pyx_pybuffernd_q_x.diminfo[0].strides = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_x.diminfo[0].shape = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_x.diminfo[1].strides = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_x.diminfo[1].shape = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_x.diminfo[2].strides = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_x.diminfo[2].shape = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.shape[2];
9896  {
9897  __Pyx_BufFmt_StackElem __pyx_stack[1];
9898  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
9899  }
9900  __pyx_pybuffernd_q_u.diminfo[0].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_u.diminfo[0].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_u.diminfo[1].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_u.diminfo[1].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[1];
9901  {
9902  __Pyx_BufFmt_StackElem __pyx_stack[1];
9903  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_mass.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_mass, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
9904  }
9905  __pyx_pybuffernd_q_mass.diminfo[0].strides = __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_mass.diminfo[0].shape = __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_mass.diminfo[1].strides = __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_mass.diminfo[1].shape = __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.shape[1];
9906  {
9907  __Pyx_BufFmt_StackElem __pyx_stack[1];
9908  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dmass.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dmass, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
9909  }
9910  __pyx_pybuffernd_q_dmass.diminfo[0].strides = __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dmass.diminfo[0].shape = __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dmass.diminfo[1].strides = __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dmass.diminfo[1].shape = __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.shape[1];
9911  {
9912  __Pyx_BufFmt_StackElem __pyx_stack[1];
9913  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_r, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
9914  }
9915  __pyx_pybuffernd_q_r.diminfo[0].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_r.diminfo[0].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_r.diminfo[1].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_r.diminfo[1].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[1];
9916  {
9917  __Pyx_BufFmt_StackElem __pyx_stack[1];
9918  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
9919  }
9920  __pyx_pybuffernd_q_kr.diminfo[0].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr.diminfo[0].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr.diminfo[1].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr.diminfo[1].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[1];
9921  {
9922  __Pyx_BufFmt_StackElem __pyx_stack[1];
9923  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dkr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
9924  }
9925  __pyx_pybuffernd_q_dkr.diminfo[0].strides = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dkr.diminfo[0].shape = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dkr.diminfo[1].strides = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dkr.diminfo[1].shape = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.shape[1];
9926  {
9927  __Pyx_BufFmt_StackElem __pyx_stack[1];
9928  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr_up, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
9929  }
9930  __pyx_pybuffernd_q_kr_up.diminfo[0].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr_up.diminfo[0].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr_up.diminfo[1].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr_up.diminfo[1].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[1];
9931 
9932  /* "subsurfaceTransportFunctions.pyx":399
9933  * """
9934  * #check some sizes
9935  * for q in [q_u,q_mass,q_r,q_kr,q_dkr]: # <<<<<<<<<<<<<<
9936  * assert q.shape[1] == nSpace+1
9937  * assert nDOF_trial_element == nSpace + 1
9938  */
9939  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 399, __pyx_L1_error)
9940  __Pyx_GOTREF(__pyx_t_1);
9941  __Pyx_INCREF(((PyObject *)__pyx_v_q_u));
9942  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_u));
9943  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_q_u));
9944  __Pyx_INCREF(((PyObject *)__pyx_v_q_mass));
9945  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_mass));
9946  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_q_mass));
9947  __Pyx_INCREF(((PyObject *)__pyx_v_q_r));
9948  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_r));
9949  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_q_r));
9950  __Pyx_INCREF(((PyObject *)__pyx_v_q_kr));
9951  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_kr));
9952  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_q_kr));
9953  __Pyx_INCREF(((PyObject *)__pyx_v_q_dkr));
9954  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_dkr));
9955  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_q_dkr));
9956  __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
9957  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9958  for (;;) {
9959  if (__pyx_t_3 >= 5) break;
9960  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9961  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 399, __pyx_L1_error)
9962  #else
9963  __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 399, __pyx_L1_error)
9964  __Pyx_GOTREF(__pyx_t_1);
9965  #endif
9966  __Pyx_XDECREF_SET(__pyx_v_q, __pyx_t_1);
9967  __pyx_t_1 = 0;
9968 
9969  /* "subsurfaceTransportFunctions.pyx":400
9970  * #check some sizes
9971  * for q in [q_u,q_mass,q_r,q_kr,q_dkr]:
9972  * assert q.shape[1] == nSpace+1 # <<<<<<<<<<<<<<
9973  * assert nDOF_trial_element == nSpace + 1
9974  * #temporaries
9975  */
9976  #ifndef CYTHON_WITHOUT_ASSERTIONS
9977  if (unlikely(!Py_OptimizeFlag)) {
9978  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_q, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 400, __pyx_L1_error)
9979  __Pyx_GOTREF(__pyx_t_1);
9980  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 400, __pyx_L1_error)
9981  __Pyx_GOTREF(__pyx_t_4);
9982  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9983  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_nSpace + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 400, __pyx_L1_error)
9984  __Pyx_GOTREF(__pyx_t_1);
9985  __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 400, __pyx_L1_error)
9986  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9987  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9988  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 400, __pyx_L1_error)
9989  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9990  if (unlikely(!__pyx_t_6)) {
9991  PyErr_SetNone(PyExc_AssertionError);
9992  __PYX_ERR(0, 400, __pyx_L1_error)
9993  }
9994  }
9995  #endif
9996 
9997  /* "subsurfaceTransportFunctions.pyx":399
9998  * """
9999  * #check some sizes
10000  * for q in [q_u,q_mass,q_r,q_kr,q_dkr]: # <<<<<<<<<<<<<<
10001  * assert q.shape[1] == nSpace+1
10002  * assert nDOF_trial_element == nSpace + 1
10003  */
10004  }
10005  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10006 
10007  /* "subsurfaceTransportFunctions.pyx":401
10008  * for q in [q_u,q_mass,q_r,q_kr,q_dkr]:
10009  * assert q.shape[1] == nSpace+1
10010  * assert nDOF_trial_element == nSpace + 1 # <<<<<<<<<<<<<<
10011  * #temporaries
10012  * cdef double psiC,pcBar,pcBar_n,pcBar_nM1,pcBar_nM2,onePlus_pcBar_n,sBar,sqrt_sBar,DsBar_DpsiC,thetaW,DthetaW_DpsiC
10013  */
10014  #ifndef CYTHON_WITHOUT_ASSERTIONS
10015  if (unlikely(!Py_OptimizeFlag)) {
10016  if (unlikely(!((__pyx_v_nDOF_trial_element == (__pyx_v_nSpace + 1)) != 0))) {
10017  PyErr_SetNone(PyExc_AssertionError);
10018  __PYX_ERR(0, 401, __pyx_L1_error)
10019  }
10020  }
10021  #endif
10022 
10023  /* "subsurfaceTransportFunctions.pyx":404
10024  * #temporaries
10025  * cdef double psiC,pcBar,pcBar_n,pcBar_nM1,pcBar_nM2,onePlus_pcBar_n,sBar,sqrt_sBar,DsBar_DpsiC,thetaW,DthetaW_DpsiC
10026  * cdef double vBar,vBar2,DvBar_DpsiC,KWr,DKWr_DpsiC,rho2=rho*rho,thetaS,rhom,drhom,m # <<<<<<<<<<<<<<
10027  *
10028  * cdef double u_j,u_eN,u_neig,kr_eN,kr_neig,phi_eN,phi_neig
10029  */
10030  __pyx_v_rho2 = (__pyx_v_rho * __pyx_v_rho);
10031 
10032  /* "subsurfaceTransportFunctions.pyx":409
10033  * cdef int eN,eN_neighbor,ebN,ii,I,j,matID
10034  * #for averaging/integration weights
10035  * cdef double nAvgWeight = 1.0/(nSpace+1.) # <<<<<<<<<<<<<<
10036  *
10037  * #loop through and evaluate
10038  */
10039  __pyx_t_7 = (__pyx_v_nSpace + 1.);
10040  if (unlikely(__pyx_t_7 == 0)) {
10041  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
10042  __PYX_ERR(0, 409, __pyx_L1_error)
10043  }
10044  __pyx_v_nAvgWeight = (1.0 / __pyx_t_7);
10045 
10046  /* "subsurfaceTransportFunctions.pyx":412
10047  *
10048  * #loop through and evaluate
10049  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
10050  * matID = elementMaterialTypes[eN]
10051  * for j in range(nDOF_trial_element):
10052  */
10053  __pyx_t_8 = __pyx_v_nElements_global;
10054  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
10055  __pyx_v_eN = __pyx_t_9;
10056 
10057  /* "subsurfaceTransportFunctions.pyx":413
10058  * #loop through and evaluate
10059  * for eN in range(nElements_global):
10060  * matID = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
10061  * for j in range(nDOF_trial_element):
10062  * u_j = u_dof[u_l2g[eN,j]]
10063  */
10064  __pyx_t_10 = __pyx_v_eN;
10065  __pyx_t_11 = -1;
10066  if (__pyx_t_10 < 0) {
10067  __pyx_t_10 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
10068  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
10069  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_11 = 0;
10070  if (unlikely(__pyx_t_11 != -1)) {
10071  __Pyx_RaiseBufferIndexError(__pyx_t_11);
10072  __PYX_ERR(0, 413, __pyx_L1_error)
10073  }
10074  __pyx_v_matID = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
10075 
10076  /* "subsurfaceTransportFunctions.pyx":414
10077  * for eN in range(nElements_global):
10078  * matID = elementMaterialTypes[eN]
10079  * for j in range(nDOF_trial_element): # <<<<<<<<<<<<<<
10080  * u_j = u_dof[u_l2g[eN,j]]
10081  * q_u[eN,j] = u_j
10082  */
10083  __pyx_t_11 = __pyx_v_nDOF_trial_element;
10084  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
10085  __pyx_v_j = __pyx_t_12;
10086 
10087  /* "subsurfaceTransportFunctions.pyx":415
10088  * matID = elementMaterialTypes[eN]
10089  * for j in range(nDOF_trial_element):
10090  * u_j = u_dof[u_l2g[eN,j]] # <<<<<<<<<<<<<<
10091  * q_u[eN,j] = u_j
10092  *
10093  */
10094  __pyx_t_13 = __pyx_v_eN;
10095  __pyx_t_14 = __pyx_v_j;
10096  __pyx_t_15 = -1;
10097  if (__pyx_t_13 < 0) {
10098  __pyx_t_13 += __pyx_pybuffernd_u_l2g.diminfo[0].shape;
10099  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 0;
10100  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_u_l2g.diminfo[0].shape)) __pyx_t_15 = 0;
10101  if (__pyx_t_14 < 0) {
10102  __pyx_t_14 += __pyx_pybuffernd_u_l2g.diminfo[1].shape;
10103  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 1;
10104  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_u_l2g.diminfo[1].shape)) __pyx_t_15 = 1;
10105  if (unlikely(__pyx_t_15 != -1)) {
10106  __Pyx_RaiseBufferIndexError(__pyx_t_15);
10107  __PYX_ERR(0, 415, __pyx_L1_error)
10108  }
10109  __pyx_t_16 = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_u_l2g.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_u_l2g.diminfo[1].strides));
10110  __pyx_t_15 = -1;
10111  if (__pyx_t_16 < 0) {
10112  __pyx_t_16 += __pyx_pybuffernd_u_dof.diminfo[0].shape;
10113  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 0;
10114  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_u_dof.diminfo[0].shape)) __pyx_t_15 = 0;
10115  if (unlikely(__pyx_t_15 != -1)) {
10116  __Pyx_RaiseBufferIndexError(__pyx_t_15);
10117  __PYX_ERR(0, 415, __pyx_L1_error)
10118  }
10119  __pyx_v_u_j = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_u_dof.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_u_dof.diminfo[0].strides));
10120 
10121  /* "subsurfaceTransportFunctions.pyx":416
10122  * for j in range(nDOF_trial_element):
10123  * u_j = u_dof[u_l2g[eN,j]]
10124  * q_u[eN,j] = u_j # <<<<<<<<<<<<<<
10125  *
10126  * #VGM evaluation
10127  */
10128  __pyx_t_17 = __pyx_v_eN;
10129  __pyx_t_18 = __pyx_v_j;
10130  __pyx_t_15 = -1;
10131  if (__pyx_t_17 < 0) {
10132  __pyx_t_17 += __pyx_pybuffernd_q_u.diminfo[0].shape;
10133  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 0;
10134  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_q_u.diminfo[0].shape)) __pyx_t_15 = 0;
10135  if (__pyx_t_18 < 0) {
10136  __pyx_t_18 += __pyx_pybuffernd_q_u.diminfo[1].shape;
10137  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 1;
10138  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_q_u.diminfo[1].shape)) __pyx_t_15 = 1;
10139  if (unlikely(__pyx_t_15 != -1)) {
10140  __Pyx_RaiseBufferIndexError(__pyx_t_15);
10141  __PYX_ERR(0, 416, __pyx_L1_error)
10142  }
10143  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_u.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_q_u.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_q_u.diminfo[1].strides) = __pyx_v_u_j;
10144 
10145  /* "subsurfaceTransportFunctions.pyx":419
10146  *
10147  * #VGM evaluation
10148  * psiC = -u_j # <<<<<<<<<<<<<<
10149  * m = 1.0 - 1.0/n[matID]
10150  * thetaS = thetaR[matID] + thetaSR[matID]
10151  */
10152  __pyx_v_psiC = (-__pyx_v_u_j);
10153 
10154  /* "subsurfaceTransportFunctions.pyx":420
10155  * #VGM evaluation
10156  * psiC = -u_j
10157  * m = 1.0 - 1.0/n[matID] # <<<<<<<<<<<<<<
10158  * thetaS = thetaR[matID] + thetaSR[matID]
10159  * if psiC > 0.0:
10160  */
10161  __pyx_t_19 = __pyx_v_matID;
10162  __pyx_t_15 = -1;
10163  if (__pyx_t_19 < 0) {
10164  __pyx_t_19 += __pyx_pybuffernd_n.diminfo[0].shape;
10165  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 0;
10166  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_15 = 0;
10167  if (unlikely(__pyx_t_15 != -1)) {
10168  __Pyx_RaiseBufferIndexError(__pyx_t_15);
10169  __PYX_ERR(0, 420, __pyx_L1_error)
10170  }
10171  __pyx_t_20 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_n.diminfo[0].strides));
10172  if (unlikely(__pyx_t_20 == 0)) {
10173  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
10174  __PYX_ERR(0, 420, __pyx_L1_error)
10175  }
10176  __pyx_v_m = (1.0 - (1.0 / __pyx_t_20));
10177 
10178  /* "subsurfaceTransportFunctions.pyx":421
10179  * psiC = -u_j
10180  * m = 1.0 - 1.0/n[matID]
10181  * thetaS = thetaR[matID] + thetaSR[matID] # <<<<<<<<<<<<<<
10182  * if psiC > 0.0:
10183  * pcBar = alpha[matID]*psiC
10184  */
10185  __pyx_t_21 = __pyx_v_matID;
10186  __pyx_t_15 = -1;
10187  if (__pyx_t_21 < 0) {
10188  __pyx_t_21 += __pyx_pybuffernd_thetaR.diminfo[0].shape;
10189  if (unlikely(__pyx_t_21 < 0)) __pyx_t_15 = 0;
10190  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_thetaR.diminfo[0].shape)) __pyx_t_15 = 0;
10191  if (unlikely(__pyx_t_15 != -1)) {
10192  __Pyx_RaiseBufferIndexError(__pyx_t_15);
10193  __PYX_ERR(0, 421, __pyx_L1_error)
10194  }
10195  __pyx_t_22 = __pyx_v_matID;
10196  __pyx_t_15 = -1;
10197  if (__pyx_t_22 < 0) {
10198  __pyx_t_22 += __pyx_pybuffernd_thetaSR.diminfo[0].shape;
10199  if (unlikely(__pyx_t_22 < 0)) __pyx_t_15 = 0;
10200  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_thetaSR.diminfo[0].shape)) __pyx_t_15 = 0;
10201  if (unlikely(__pyx_t_15 != -1)) {
10202  __Pyx_RaiseBufferIndexError(__pyx_t_15);
10203  __PYX_ERR(0, 421, __pyx_L1_error)
10204  }
10205  __pyx_v_thetaS = ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaR.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_thetaR.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_thetaSR.diminfo[0].strides)));
10206 
10207  /* "subsurfaceTransportFunctions.pyx":422
10208  * m = 1.0 - 1.0/n[matID]
10209  * thetaS = thetaR[matID] + thetaSR[matID]
10210  * if psiC > 0.0: # <<<<<<<<<<<<<<
10211  * pcBar = alpha[matID]*psiC
10212  * pcBar_nM2 = pow(pcBar,n[matID]-2)
10213  */
10214  __pyx_t_6 = ((__pyx_v_psiC > 0.0) != 0);
10215  if (__pyx_t_6) {
10216 
10217  /* "subsurfaceTransportFunctions.pyx":423
10218  * thetaS = thetaR[matID] + thetaSR[matID]
10219  * if psiC > 0.0:
10220  * pcBar = alpha[matID]*psiC # <<<<<<<<<<<<<<
10221  * pcBar_nM2 = pow(pcBar,n[matID]-2)
10222  * pcBar_nM1 = pcBar_nM2*pcBar
10223  */
10224  __pyx_t_23 = __pyx_v_matID;
10225  __pyx_t_15 = -1;
10226  if (__pyx_t_23 < 0) {
10227  __pyx_t_23 += __pyx_pybuffernd_alpha.diminfo[0].shape;
10228  if (unlikely(__pyx_t_23 < 0)) __pyx_t_15 = 0;
10229  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_alpha.diminfo[0].shape)) __pyx_t_15 = 0;
10230  if (unlikely(__pyx_t_15 != -1)) {
10231  __Pyx_RaiseBufferIndexError(__pyx_t_15);
10232  __PYX_ERR(0, 423, __pyx_L1_error)
10233  }
10234  __pyx_v_pcBar = ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_alpha.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_alpha.diminfo[0].strides)) * __pyx_v_psiC);
10235 
10236  /* "subsurfaceTransportFunctions.pyx":424
10237  * if psiC > 0.0:
10238  * pcBar = alpha[matID]*psiC
10239  * pcBar_nM2 = pow(pcBar,n[matID]-2) # <<<<<<<<<<<<<<
10240  * pcBar_nM1 = pcBar_nM2*pcBar
10241  * pcBar_n = pcBar_nM1*pcBar
10242  */
10243  __pyx_t_24 = __pyx_v_matID;
10244  __pyx_t_15 = -1;
10245  if (__pyx_t_24 < 0) {
10246  __pyx_t_24 += __pyx_pybuffernd_n.diminfo[0].shape;
10247  if (unlikely(__pyx_t_24 < 0)) __pyx_t_15 = 0;
10248  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_15 = 0;
10249  if (unlikely(__pyx_t_15 != -1)) {
10250  __Pyx_RaiseBufferIndexError(__pyx_t_15);
10251  __PYX_ERR(0, 424, __pyx_L1_error)
10252  }
10253  __pyx_v_pcBar_nM2 = pow(__pyx_v_pcBar, ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_n.diminfo[0].strides)) - 2.0));
10254 
10255  /* "subsurfaceTransportFunctions.pyx":425
10256  * pcBar = alpha[matID]*psiC
10257  * pcBar_nM2 = pow(pcBar,n[matID]-2)
10258  * pcBar_nM1 = pcBar_nM2*pcBar # <<<<<<<<<<<<<<
10259  * pcBar_n = pcBar_nM1*pcBar
10260  * onePlus_pcBar_n = 1.0 + pcBar_n
10261  */
10262  __pyx_v_pcBar_nM1 = (__pyx_v_pcBar_nM2 * __pyx_v_pcBar);
10263 
10264  /* "subsurfaceTransportFunctions.pyx":426
10265  * pcBar_nM2 = pow(pcBar,n[matID]-2)
10266  * pcBar_nM1 = pcBar_nM2*pcBar
10267  * pcBar_n = pcBar_nM1*pcBar # <<<<<<<<<<<<<<
10268  * onePlus_pcBar_n = 1.0 + pcBar_n
10269  *
10270  */
10271  __pyx_v_pcBar_n = (__pyx_v_pcBar_nM1 * __pyx_v_pcBar);
10272 
10273  /* "subsurfaceTransportFunctions.pyx":427
10274  * pcBar_nM1 = pcBar_nM2*pcBar
10275  * pcBar_n = pcBar_nM1*pcBar
10276  * onePlus_pcBar_n = 1.0 + pcBar_n # <<<<<<<<<<<<<<
10277  *
10278  * sBar = pow(onePlus_pcBar_n,-m)
10279  */
10280  __pyx_v_onePlus_pcBar_n = (1.0 + __pyx_v_pcBar_n);
10281 
10282  /* "subsurfaceTransportFunctions.pyx":429
10283  * onePlus_pcBar_n = 1.0 + pcBar_n
10284  *
10285  * sBar = pow(onePlus_pcBar_n,-m) # <<<<<<<<<<<<<<
10286  * # using -mn = 1-n
10287  * DsBar_DpsiC = alpha[matID]*(1.0-n[matID])*(sBar/onePlus_pcBar_n)*pcBar_nM1
10288  */
10289  __pyx_v_sBar = pow(__pyx_v_onePlus_pcBar_n, (-__pyx_v_m));
10290 
10291  /* "subsurfaceTransportFunctions.pyx":431
10292  * sBar = pow(onePlus_pcBar_n,-m)
10293  * # using -mn = 1-n
10294  * DsBar_DpsiC = alpha[matID]*(1.0-n[matID])*(sBar/onePlus_pcBar_n)*pcBar_nM1 # <<<<<<<<<<<<<<
10295  *
10296  * vBar = 1.0-pcBar_nM1*sBar
10297  */
10298  __pyx_t_25 = __pyx_v_matID;
10299  __pyx_t_15 = -1;
10300  if (__pyx_t_25 < 0) {
10301  __pyx_t_25 += __pyx_pybuffernd_alpha.diminfo[0].shape;
10302  if (unlikely(__pyx_t_25 < 0)) __pyx_t_15 = 0;
10303  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_alpha.diminfo[0].shape)) __pyx_t_15 = 0;
10304  if (unlikely(__pyx_t_15 != -1)) {
10305  __Pyx_RaiseBufferIndexError(__pyx_t_15);
10306  __PYX_ERR(0, 431, __pyx_L1_error)
10307  }
10308  __pyx_t_26 = __pyx_v_matID;
10309  __pyx_t_15 = -1;
10310  if (__pyx_t_26 < 0) {
10311  __pyx_t_26 += __pyx_pybuffernd_n.diminfo[0].shape;
10312  if (unlikely(__pyx_t_26 < 0)) __pyx_t_15 = 0;
10313  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_15 = 0;
10314  if (unlikely(__pyx_t_15 != -1)) {
10315  __Pyx_RaiseBufferIndexError(__pyx_t_15);
10316  __PYX_ERR(0, 431, __pyx_L1_error)
10317  }
10318  if (unlikely(__pyx_v_onePlus_pcBar_n == 0)) {
10319  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
10320  __PYX_ERR(0, 431, __pyx_L1_error)
10321  }
10322  __pyx_v_DsBar_DpsiC = ((((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_alpha.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_alpha.diminfo[0].strides)) * (1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_n.diminfo[0].strides)))) * (__pyx_v_sBar / __pyx_v_onePlus_pcBar_n)) * __pyx_v_pcBar_nM1);
10323 
10324  /* "subsurfaceTransportFunctions.pyx":433
10325  * DsBar_DpsiC = alpha[matID]*(1.0-n[matID])*(sBar/onePlus_pcBar_n)*pcBar_nM1
10326  *
10327  * vBar = 1.0-pcBar_nM1*sBar # <<<<<<<<<<<<<<
10328  * vBar2 = vBar*vBar
10329  * DvBar_DpsiC = -alpha[matID]*(n[matID]-1.0)*pcBar_nM2*sBar - pcBar_nM1*DsBar_DpsiC
10330  */
10331  __pyx_v_vBar = (1.0 - (__pyx_v_pcBar_nM1 * __pyx_v_sBar));
10332 
10333  /* "subsurfaceTransportFunctions.pyx":434
10334  *
10335  * vBar = 1.0-pcBar_nM1*sBar
10336  * vBar2 = vBar*vBar # <<<<<<<<<<<<<<
10337  * DvBar_DpsiC = -alpha[matID]*(n[matID]-1.0)*pcBar_nM2*sBar - pcBar_nM1*DsBar_DpsiC
10338  *
10339  */
10340  __pyx_v_vBar2 = (__pyx_v_vBar * __pyx_v_vBar);
10341 
10342  /* "subsurfaceTransportFunctions.pyx":435
10343  * vBar = 1.0-pcBar_nM1*sBar
10344  * vBar2 = vBar*vBar
10345  * DvBar_DpsiC = -alpha[matID]*(n[matID]-1.0)*pcBar_nM2*sBar - pcBar_nM1*DsBar_DpsiC # <<<<<<<<<<<<<<
10346  *
10347  * thetaW = thetaSR[matID]*sBar + thetaR[matID]
10348  */
10349  __pyx_t_27 = __pyx_v_matID;
10350  __pyx_t_15 = -1;
10351  if (__pyx_t_27 < 0) {
10352  __pyx_t_27 += __pyx_pybuffernd_alpha.diminfo[0].shape;
10353  if (unlikely(__pyx_t_27 < 0)) __pyx_t_15 = 0;
10354  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_alpha.diminfo[0].shape)) __pyx_t_15 = 0;
10355  if (unlikely(__pyx_t_15 != -1)) {
10356  __Pyx_RaiseBufferIndexError(__pyx_t_15);
10357  __PYX_ERR(0, 435, __pyx_L1_error)
10358  }
10359  __pyx_t_28 = __pyx_v_matID;
10360  __pyx_t_15 = -1;
10361  if (__pyx_t_28 < 0) {
10362  __pyx_t_28 += __pyx_pybuffernd_n.diminfo[0].shape;
10363  if (unlikely(__pyx_t_28 < 0)) __pyx_t_15 = 0;
10364  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_15 = 0;
10365  if (unlikely(__pyx_t_15 != -1)) {
10366  __Pyx_RaiseBufferIndexError(__pyx_t_15);
10367  __PYX_ERR(0, 435, __pyx_L1_error)
10368  }
10369  __pyx_v_DvBar_DpsiC = (((((-(*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_alpha.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_alpha.diminfo[0].strides))) * ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_n.diminfo[0].strides)) - 1.0)) * __pyx_v_pcBar_nM2) * __pyx_v_sBar) - (__pyx_v_pcBar_nM1 * __pyx_v_DsBar_DpsiC));
10370 
10371  /* "subsurfaceTransportFunctions.pyx":437
10372  * DvBar_DpsiC = -alpha[matID]*(n[matID]-1.0)*pcBar_nM2*sBar - pcBar_nM1*DsBar_DpsiC
10373  *
10374  * thetaW = thetaSR[matID]*sBar + thetaR[matID] # <<<<<<<<<<<<<<
10375  * DthetaW_DpsiC = thetaSR[matID] * DsBar_DpsiC
10376  *
10377  */
10378  __pyx_t_29 = __pyx_v_matID;
10379  __pyx_t_15 = -1;
10380  if (__pyx_t_29 < 0) {
10381  __pyx_t_29 += __pyx_pybuffernd_thetaSR.diminfo[0].shape;
10382  if (unlikely(__pyx_t_29 < 0)) __pyx_t_15 = 0;
10383  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_thetaSR.diminfo[0].shape)) __pyx_t_15 = 0;
10384  if (unlikely(__pyx_t_15 != -1)) {
10385  __Pyx_RaiseBufferIndexError(__pyx_t_15);
10386  __PYX_ERR(0, 437, __pyx_L1_error)
10387  }
10388  __pyx_t_30 = __pyx_v_matID;
10389  __pyx_t_15 = -1;
10390  if (__pyx_t_30 < 0) {
10391  __pyx_t_30 += __pyx_pybuffernd_thetaR.diminfo[0].shape;
10392  if (unlikely(__pyx_t_30 < 0)) __pyx_t_15 = 0;
10393  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_thetaR.diminfo[0].shape)) __pyx_t_15 = 0;
10394  if (unlikely(__pyx_t_15 != -1)) {
10395  __Pyx_RaiseBufferIndexError(__pyx_t_15);
10396  __PYX_ERR(0, 437, __pyx_L1_error)
10397  }
10398  __pyx_v_thetaW = (((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_thetaSR.diminfo[0].strides)) * __pyx_v_sBar) + (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaR.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_thetaR.diminfo[0].strides)));
10399 
10400  /* "subsurfaceTransportFunctions.pyx":438
10401  *
10402  * thetaW = thetaSR[matID]*sBar + thetaR[matID]
10403  * DthetaW_DpsiC = thetaSR[matID] * DsBar_DpsiC # <<<<<<<<<<<<<<
10404  *
10405  * sqrt_sBar = sqrt(sBar)
10406  */
10407  __pyx_t_31 = __pyx_v_matID;
10408  __pyx_t_15 = -1;
10409  if (__pyx_t_31 < 0) {
10410  __pyx_t_31 += __pyx_pybuffernd_thetaSR.diminfo[0].shape;
10411  if (unlikely(__pyx_t_31 < 0)) __pyx_t_15 = 0;
10412  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_thetaSR.diminfo[0].shape)) __pyx_t_15 = 0;
10413  if (unlikely(__pyx_t_15 != -1)) {
10414  __Pyx_RaiseBufferIndexError(__pyx_t_15);
10415  __PYX_ERR(0, 438, __pyx_L1_error)
10416  }
10417  __pyx_v_DthetaW_DpsiC = ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_thetaSR.diminfo[0].strides)) * __pyx_v_DsBar_DpsiC);
10418 
10419  /* "subsurfaceTransportFunctions.pyx":440
10420  * DthetaW_DpsiC = thetaSR[matID] * DsBar_DpsiC
10421  *
10422  * sqrt_sBar = sqrt(sBar) # <<<<<<<<<<<<<<
10423  * KWr= sqrt_sBar*vBar2
10424  * DKWr_DpsiC= ((0.5/sqrt_sBar)*DsBar_DpsiC*vBar2 + 2.0*sqrt_sBar*vBar*DvBar_DpsiC)
10425  */
10426  __pyx_v_sqrt_sBar = sqrt(__pyx_v_sBar);
10427 
10428  /* "subsurfaceTransportFunctions.pyx":441
10429  *
10430  * sqrt_sBar = sqrt(sBar)
10431  * KWr= sqrt_sBar*vBar2 # <<<<<<<<<<<<<<
10432  * DKWr_DpsiC= ((0.5/sqrt_sBar)*DsBar_DpsiC*vBar2 + 2.0*sqrt_sBar*vBar*DvBar_DpsiC)
10433  * else:
10434  */
10435  __pyx_v_KWr = (__pyx_v_sqrt_sBar * __pyx_v_vBar2);
10436 
10437  /* "subsurfaceTransportFunctions.pyx":442
10438  * sqrt_sBar = sqrt(sBar)
10439  * KWr= sqrt_sBar*vBar2
10440  * DKWr_DpsiC= ((0.5/sqrt_sBar)*DsBar_DpsiC*vBar2 + 2.0*sqrt_sBar*vBar*DvBar_DpsiC) # <<<<<<<<<<<<<<
10441  * else:
10442  * thetaW = thetaS
10443  */
10444  if (unlikely(__pyx_v_sqrt_sBar == 0)) {
10445  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
10446  __PYX_ERR(0, 442, __pyx_L1_error)
10447  }
10448  __pyx_v_DKWr_DpsiC = ((((0.5 / __pyx_v_sqrt_sBar) * __pyx_v_DsBar_DpsiC) * __pyx_v_vBar2) + (((2.0 * __pyx_v_sqrt_sBar) * __pyx_v_vBar) * __pyx_v_DvBar_DpsiC));
10449 
10450  /* "subsurfaceTransportFunctions.pyx":422
10451  * m = 1.0 - 1.0/n[matID]
10452  * thetaS = thetaR[matID] + thetaSR[matID]
10453  * if psiC > 0.0: # <<<<<<<<<<<<<<
10454  * pcBar = alpha[matID]*psiC
10455  * pcBar_nM2 = pow(pcBar,n[matID]-2)
10456  */
10457  goto __pyx_L9;
10458  }
10459 
10460  /* "subsurfaceTransportFunctions.pyx":444
10461  * DKWr_DpsiC= ((0.5/sqrt_sBar)*DsBar_DpsiC*vBar2 + 2.0*sqrt_sBar*vBar*DvBar_DpsiC)
10462  * else:
10463  * thetaW = thetaS # <<<<<<<<<<<<<<
10464  * DthetaW_DpsiC = 0.0
10465  * KWr = 1.0
10466  */
10467  /*else*/ {
10468  __pyx_v_thetaW = __pyx_v_thetaS;
10469 
10470  /* "subsurfaceTransportFunctions.pyx":445
10471  * else:
10472  * thetaW = thetaS
10473  * DthetaW_DpsiC = 0.0 # <<<<<<<<<<<<<<
10474  * KWr = 1.0
10475  * DKWr_DpsiC = 0.0
10476  */
10477  __pyx_v_DthetaW_DpsiC = 0.0;
10478 
10479  /* "subsurfaceTransportFunctions.pyx":446
10480  * thetaW = thetaS
10481  * DthetaW_DpsiC = 0.0
10482  * KWr = 1.0 # <<<<<<<<<<<<<<
10483  * DKWr_DpsiC = 0.0
10484  * #
10485  */
10486  __pyx_v_KWr = 1.0;
10487 
10488  /* "subsurfaceTransportFunctions.pyx":447
10489  * DthetaW_DpsiC = 0.0
10490  * KWr = 1.0
10491  * DKWr_DpsiC = 0.0 # <<<<<<<<<<<<<<
10492  * #
10493  * rhom = rho*exp(beta*u_j)
10494  */
10495  __pyx_v_DKWr_DpsiC = 0.0;
10496  }
10497  __pyx_L9:;
10498 
10499  /* "subsurfaceTransportFunctions.pyx":449
10500  * DKWr_DpsiC = 0.0
10501  * #
10502  * rhom = rho*exp(beta*u_j) # <<<<<<<<<<<<<<
10503  * drhom= beta*rhom
10504  * q_mass[eN,j] = rhom*thetaW
10505  */
10506  __pyx_v_rhom = (__pyx_v_rho * exp((__pyx_v_beta * __pyx_v_u_j)));
10507 
10508  /* "subsurfaceTransportFunctions.pyx":450
10509  * #
10510  * rhom = rho*exp(beta*u_j)
10511  * drhom= beta*rhom # <<<<<<<<<<<<<<
10512  * q_mass[eN,j] = rhom*thetaW
10513  * q_dmass[eN,j]=-rhom*DthetaW_DpsiC+drhom*thetaW
10514  */
10515  __pyx_v_drhom = (__pyx_v_beta * __pyx_v_rhom);
10516 
10517  /* "subsurfaceTransportFunctions.pyx":451
10518  * rhom = rho*exp(beta*u_j)
10519  * drhom= beta*rhom
10520  * q_mass[eN,j] = rhom*thetaW # <<<<<<<<<<<<<<
10521  * q_dmass[eN,j]=-rhom*DthetaW_DpsiC+drhom*thetaW
10522  *
10523  */
10524  __pyx_t_32 = __pyx_v_eN;
10525  __pyx_t_33 = __pyx_v_j;
10526  __pyx_t_15 = -1;
10527  if (__pyx_t_32 < 0) {
10528  __pyx_t_32 += __pyx_pybuffernd_q_mass.diminfo[0].shape;
10529  if (unlikely(__pyx_t_32 < 0)) __pyx_t_15 = 0;
10530  } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_q_mass.diminfo[0].shape)) __pyx_t_15 = 0;
10531  if (__pyx_t_33 < 0) {
10532  __pyx_t_33 += __pyx_pybuffernd_q_mass.diminfo[1].shape;
10533  if (unlikely(__pyx_t_33 < 0)) __pyx_t_15 = 1;
10534  } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_q_mass.diminfo[1].shape)) __pyx_t_15 = 1;
10535  if (unlikely(__pyx_t_15 != -1)) {
10536  __Pyx_RaiseBufferIndexError(__pyx_t_15);
10537  __PYX_ERR(0, 451, __pyx_L1_error)
10538  }
10539  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_q_mass.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_q_mass.diminfo[1].strides) = (__pyx_v_rhom * __pyx_v_thetaW);
10540 
10541  /* "subsurfaceTransportFunctions.pyx":452
10542  * drhom= beta*rhom
10543  * q_mass[eN,j] = rhom*thetaW
10544  * q_dmass[eN,j]=-rhom*DthetaW_DpsiC+drhom*thetaW # <<<<<<<<<<<<<<
10545  *
10546  * q_kr[eN,j] = KWr
10547  */
10548  __pyx_t_34 = __pyx_v_eN;
10549  __pyx_t_35 = __pyx_v_j;
10550  __pyx_t_15 = -1;
10551  if (__pyx_t_34 < 0) {
10552  __pyx_t_34 += __pyx_pybuffernd_q_dmass.diminfo[0].shape;
10553  if (unlikely(__pyx_t_34 < 0)) __pyx_t_15 = 0;
10554  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_q_dmass.diminfo[0].shape)) __pyx_t_15 = 0;
10555  if (__pyx_t_35 < 0) {
10556  __pyx_t_35 += __pyx_pybuffernd_q_dmass.diminfo[1].shape;
10557  if (unlikely(__pyx_t_35 < 0)) __pyx_t_15 = 1;
10558  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_q_dmass.diminfo[1].shape)) __pyx_t_15 = 1;
10559  if (unlikely(__pyx_t_15 != -1)) {
10560  __Pyx_RaiseBufferIndexError(__pyx_t_15);
10561  __PYX_ERR(0, 452, __pyx_L1_error)
10562  }
10563  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_q_dmass.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_q_dmass.diminfo[1].strides) = (((-__pyx_v_rhom) * __pyx_v_DthetaW_DpsiC) + (__pyx_v_drhom * __pyx_v_thetaW));
10564 
10565  /* "subsurfaceTransportFunctions.pyx":454
10566  * q_dmass[eN,j]=-rhom*DthetaW_DpsiC+drhom*thetaW
10567  *
10568  * q_kr[eN,j] = KWr # <<<<<<<<<<<<<<
10569  * q_dkr[eN,j]= -DKWr_DpsiC
10570  *
10571  */
10572  __pyx_t_36 = __pyx_v_eN;
10573  __pyx_t_37 = __pyx_v_j;
10574  __pyx_t_15 = -1;
10575  if (__pyx_t_36 < 0) {
10576  __pyx_t_36 += __pyx_pybuffernd_q_kr.diminfo[0].shape;
10577  if (unlikely(__pyx_t_36 < 0)) __pyx_t_15 = 0;
10578  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_q_kr.diminfo[0].shape)) __pyx_t_15 = 0;
10579  if (__pyx_t_37 < 0) {
10580  __pyx_t_37 += __pyx_pybuffernd_q_kr.diminfo[1].shape;
10581  if (unlikely(__pyx_t_37 < 0)) __pyx_t_15 = 1;
10582  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_q_kr.diminfo[1].shape)) __pyx_t_15 = 1;
10583  if (unlikely(__pyx_t_15 != -1)) {
10584  __Pyx_RaiseBufferIndexError(__pyx_t_15);
10585  __PYX_ERR(0, 454, __pyx_L1_error)
10586  }
10587  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_q_kr.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_q_kr.diminfo[1].strides) = __pyx_v_KWr;
10588 
10589  /* "subsurfaceTransportFunctions.pyx":455
10590  *
10591  * q_kr[eN,j] = KWr
10592  * q_dkr[eN,j]= -DKWr_DpsiC # <<<<<<<<<<<<<<
10593  *
10594  * #j
10595  */
10596  __pyx_t_38 = __pyx_v_eN;
10597  __pyx_t_39 = __pyx_v_j;
10598  __pyx_t_15 = -1;
10599  if (__pyx_t_38 < 0) {
10600  __pyx_t_38 += __pyx_pybuffernd_q_dkr.diminfo[0].shape;
10601  if (unlikely(__pyx_t_38 < 0)) __pyx_t_15 = 0;
10602  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_q_dkr.diminfo[0].shape)) __pyx_t_15 = 0;
10603  if (__pyx_t_39 < 0) {
10604  __pyx_t_39 += __pyx_pybuffernd_q_dkr.diminfo[1].shape;
10605  if (unlikely(__pyx_t_39 < 0)) __pyx_t_15 = 1;
10606  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_q_dkr.diminfo[1].shape)) __pyx_t_15 = 1;
10607  if (unlikely(__pyx_t_15 != -1)) {
10608  __Pyx_RaiseBufferIndexError(__pyx_t_15);
10609  __PYX_ERR(0, 455, __pyx_L1_error)
10610  }
10611  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_q_dkr.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_q_dkr.diminfo[1].strides) = (-__pyx_v_DKWr_DpsiC);
10612  }
10613  }
10614 
10615  /* "subsurfaceTransportFunctions.pyx":461
10616  *
10617  * #now upwind kr
10618  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
10619  * u_eN = numpy.sum(q_u[eN])*nAvgWeight
10620  * kr_eN = numpy.sum(q_kr[eN])*nAvgWeight
10621  */
10622  __pyx_t_8 = __pyx_v_nElements_global;
10623  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
10624  __pyx_v_eN = __pyx_t_9;
10625 
10626  /* "subsurfaceTransportFunctions.pyx":462
10627  * #now upwind kr
10628  * for eN in range(nElements_global):
10629  * u_eN = numpy.sum(q_u[eN])*nAvgWeight # <<<<<<<<<<<<<<
10630  * kr_eN = numpy.sum(q_kr[eN])*nAvgWeight
10631  * #potential assumes slight compressibility
10632  */
10633  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 462, __pyx_L1_error)
10634  __Pyx_GOTREF(__pyx_t_5);
10635  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_sum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __pyx_L1_error)
10636  __Pyx_GOTREF(__pyx_t_1);
10637  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10638  __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_q_u), __pyx_v_eN, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 462, __pyx_L1_error)
10639  __Pyx_GOTREF(__pyx_t_5);
10640  __pyx_t_4 = NULL;
10641  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
10642  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
10643  if (likely(__pyx_t_4)) {
10644  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
10645  __Pyx_INCREF(__pyx_t_4);
10646  __Pyx_INCREF(function);
10647  __Pyx_DECREF_SET(__pyx_t_1, function);
10648  }
10649  }
10650  if (!__pyx_t_4) {
10651  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 462, __pyx_L1_error)
10652  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10653  __Pyx_GOTREF(__pyx_t_2);
10654  } else {
10655  #if CYTHON_FAST_PYCALL
10656  if (PyFunction_Check(__pyx_t_1)) {
10657  PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_5};
10658  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 462, __pyx_L1_error)
10659  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
10660  __Pyx_GOTREF(__pyx_t_2);
10661  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10662  } else
10663  #endif
10664  #if CYTHON_FAST_PYCCALL
10665  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
10666  PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_5};
10667  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 462, __pyx_L1_error)
10668  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
10669  __Pyx_GOTREF(__pyx_t_2);
10670  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10671  } else
10672  #endif
10673  {
10674  __pyx_t_40 = PyTuple_New(1+1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 462, __pyx_L1_error)
10675  __Pyx_GOTREF(__pyx_t_40);
10676  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_40, 0, __pyx_t_4); __pyx_t_4 = NULL;
10677  __Pyx_GIVEREF(__pyx_t_5);
10678  PyTuple_SET_ITEM(__pyx_t_40, 0+1, __pyx_t_5);
10679  __pyx_t_5 = 0;
10680  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_40, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 462, __pyx_L1_error)
10681  __Pyx_GOTREF(__pyx_t_2);
10682  __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
10683  }
10684  }
10685  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10686  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_nAvgWeight); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __pyx_L1_error)
10687  __Pyx_GOTREF(__pyx_t_1);
10688  __pyx_t_40 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 462, __pyx_L1_error)
10689  __Pyx_GOTREF(__pyx_t_40);
10690  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10691  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10692  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_40); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 462, __pyx_L1_error)
10693  __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
10694  __pyx_v_u_eN = __pyx_t_7;
10695 
10696  /* "subsurfaceTransportFunctions.pyx":463
10697  * for eN in range(nElements_global):
10698  * u_eN = numpy.sum(q_u[eN])*nAvgWeight
10699  * kr_eN = numpy.sum(q_kr[eN])*nAvgWeight # <<<<<<<<<<<<<<
10700  * #potential assumes slight compressibility
10701  * phi_eN= u_eN - numpy.dot(gravity,elementBarycentersArray[eN])
10702  */
10703  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error)
10704  __Pyx_GOTREF(__pyx_t_1);
10705  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 463, __pyx_L1_error)
10706  __Pyx_GOTREF(__pyx_t_2);
10707  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10708  __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_q_kr), __pyx_v_eN, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error)
10709  __Pyx_GOTREF(__pyx_t_1);
10710  __pyx_t_5 = NULL;
10711  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
10712  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
10713  if (likely(__pyx_t_5)) {
10714  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
10715  __Pyx_INCREF(__pyx_t_5);
10716  __Pyx_INCREF(function);
10717  __Pyx_DECREF_SET(__pyx_t_2, function);
10718  }
10719  }
10720  if (!__pyx_t_5) {
10721  __pyx_t_40 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 463, __pyx_L1_error)
10722  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10723  __Pyx_GOTREF(__pyx_t_40);
10724  } else {
10725  #if CYTHON_FAST_PYCALL
10726  if (PyFunction_Check(__pyx_t_2)) {
10727  PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_1};
10728  __pyx_t_40 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 463, __pyx_L1_error)
10729  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10730  __Pyx_GOTREF(__pyx_t_40);
10731  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10732  } else
10733  #endif
10734  #if CYTHON_FAST_PYCCALL
10735  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
10736  PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_1};
10737  __pyx_t_40 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 463, __pyx_L1_error)
10738  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10739  __Pyx_GOTREF(__pyx_t_40);
10740  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10741  } else
10742  #endif
10743  {
10744  __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 463, __pyx_L1_error)
10745  __Pyx_GOTREF(__pyx_t_4);
10746  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
10747  __Pyx_GIVEREF(__pyx_t_1);
10748  PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_1);
10749  __pyx_t_1 = 0;
10750  __pyx_t_40 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 463, __pyx_L1_error)
10751  __Pyx_GOTREF(__pyx_t_40);
10752  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10753  }
10754  }
10755  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10756  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_nAvgWeight); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 463, __pyx_L1_error)
10757  __Pyx_GOTREF(__pyx_t_2);
10758  __pyx_t_4 = PyNumber_Multiply(__pyx_t_40, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 463, __pyx_L1_error)
10759  __Pyx_GOTREF(__pyx_t_4);
10760  __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
10761  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10762  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 463, __pyx_L1_error)
10763  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10764  __pyx_v_kr_eN = __pyx_t_7;
10765 
10766  /* "subsurfaceTransportFunctions.pyx":465
10767  * kr_eN = numpy.sum(q_kr[eN])*nAvgWeight
10768  * #potential assumes slight compressibility
10769  * phi_eN= u_eN - numpy.dot(gravity,elementBarycentersArray[eN]) # <<<<<<<<<<<<<<
10770  *
10771  *
10772  */
10773  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_u_eN); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 465, __pyx_L1_error)
10774  __Pyx_GOTREF(__pyx_t_4);
10775  __pyx_t_40 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 465, __pyx_L1_error)
10776  __Pyx_GOTREF(__pyx_t_40);
10777  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_40, __pyx_n_s_dot); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 465, __pyx_L1_error)
10778  __Pyx_GOTREF(__pyx_t_1);
10779  __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
10780  __pyx_t_40 = __Pyx_GetItemInt(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_v_eN, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 465, __pyx_L1_error)
10781  __Pyx_GOTREF(__pyx_t_40);
10782  __pyx_t_5 = NULL;
10783  __pyx_t_11 = 0;
10784  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
10785  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
10786  if (likely(__pyx_t_5)) {
10787  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
10788  __Pyx_INCREF(__pyx_t_5);
10789  __Pyx_INCREF(function);
10790  __Pyx_DECREF_SET(__pyx_t_1, function);
10791  __pyx_t_11 = 1;
10792  }
10793  }
10794  #if CYTHON_FAST_PYCALL
10795  if (PyFunction_Check(__pyx_t_1)) {
10796  PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_gravity), __pyx_t_40};
10797  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error)
10798  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10799  __Pyx_GOTREF(__pyx_t_2);
10800  __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
10801  } else
10802  #endif
10803  #if CYTHON_FAST_PYCCALL
10804  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
10805  PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_gravity), __pyx_t_40};
10806  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error)
10807  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10808  __Pyx_GOTREF(__pyx_t_2);
10809  __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
10810  } else
10811  #endif
10812  {
10813  __pyx_t_41 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 465, __pyx_L1_error)
10814  __Pyx_GOTREF(__pyx_t_41);
10815  if (__pyx_t_5) {
10816  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_41, 0, __pyx_t_5); __pyx_t_5 = NULL;
10817  }
10818  __Pyx_INCREF(((PyObject *)__pyx_v_gravity));
10819  __Pyx_GIVEREF(((PyObject *)__pyx_v_gravity));
10820  PyTuple_SET_ITEM(__pyx_t_41, 0+__pyx_t_11, ((PyObject *)__pyx_v_gravity));
10821  __Pyx_GIVEREF(__pyx_t_40);
10822  PyTuple_SET_ITEM(__pyx_t_41, 1+__pyx_t_11, __pyx_t_40);
10823  __pyx_t_40 = 0;
10824  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_41, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error)
10825  __Pyx_GOTREF(__pyx_t_2);
10826  __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
10827  }
10828  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10829  __pyx_t_1 = PyNumber_Subtract(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 465, __pyx_L1_error)
10830  __Pyx_GOTREF(__pyx_t_1);
10831  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10832  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10833  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 465, __pyx_L1_error)
10834  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10835  __pyx_v_phi_eN = __pyx_t_7;
10836 
10837  /* "subsurfaceTransportFunctions.pyx":469
10838  *
10839  * #loop over faces to upwind
10840  * for ebN in range(nElementBoundaries_element): # <<<<<<<<<<<<<<
10841  * #by default eN is upwind
10842  * q_kr_up[eN,ebN] = kr_eN
10843  */
10844  __pyx_t_11 = __pyx_v_nElementBoundaries_element;
10845  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
10846  __pyx_v_ebN = __pyx_t_12;
10847 
10848  /* "subsurfaceTransportFunctions.pyx":471
10849  * for ebN in range(nElementBoundaries_element):
10850  * #by default eN is upwind
10851  * q_kr_up[eN,ebN] = kr_eN # <<<<<<<<<<<<<<
10852  * eN_neighbor = elementNeighborsArray[eN,ebN]
10853  * if eN_neighbor >= 0:
10854  */
10855  __pyx_t_42 = __pyx_v_eN;
10856  __pyx_t_43 = __pyx_v_ebN;
10857  __pyx_t_15 = -1;
10858  if (__pyx_t_42 < 0) {
10859  __pyx_t_42 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
10860  if (unlikely(__pyx_t_42 < 0)) __pyx_t_15 = 0;
10861  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_15 = 0;
10862  if (__pyx_t_43 < 0) {
10863  __pyx_t_43 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
10864  if (unlikely(__pyx_t_43 < 0)) __pyx_t_15 = 1;
10865  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_15 = 1;
10866  if (unlikely(__pyx_t_15 != -1)) {
10867  __Pyx_RaiseBufferIndexError(__pyx_t_15);
10868  __PYX_ERR(0, 471, __pyx_L1_error)
10869  }
10870  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_q_kr_up.diminfo[1].strides) = __pyx_v_kr_eN;
10871 
10872  /* "subsurfaceTransportFunctions.pyx":472
10873  * #by default eN is upwind
10874  * q_kr_up[eN,ebN] = kr_eN
10875  * eN_neighbor = elementNeighborsArray[eN,ebN] # <<<<<<<<<<<<<<
10876  * if eN_neighbor >= 0:
10877  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight
10878  */
10879  __pyx_t_44 = __pyx_v_eN;
10880  __pyx_t_45 = __pyx_v_ebN;
10881  __pyx_t_15 = -1;
10882  if (__pyx_t_44 < 0) {
10883  __pyx_t_44 += __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape;
10884  if (unlikely(__pyx_t_44 < 0)) __pyx_t_15 = 0;
10885  } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape)) __pyx_t_15 = 0;
10886  if (__pyx_t_45 < 0) {
10887  __pyx_t_45 += __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape;
10888  if (unlikely(__pyx_t_45 < 0)) __pyx_t_15 = 1;
10889  } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape)) __pyx_t_15 = 1;
10890  if (unlikely(__pyx_t_15 != -1)) {
10891  __Pyx_RaiseBufferIndexError(__pyx_t_15);
10892  __PYX_ERR(0, 472, __pyx_L1_error)
10893  }
10894  __pyx_v_eN_neighbor = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides));
10895 
10896  /* "subsurfaceTransportFunctions.pyx":473
10897  * q_kr_up[eN,ebN] = kr_eN
10898  * eN_neighbor = elementNeighborsArray[eN,ebN]
10899  * if eN_neighbor >= 0: # <<<<<<<<<<<<<<
10900  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight
10901  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight
10902  */
10903  __pyx_t_6 = ((__pyx_v_eN_neighbor >= 0) != 0);
10904  if (__pyx_t_6) {
10905 
10906  /* "subsurfaceTransportFunctions.pyx":474
10907  * eN_neighbor = elementNeighborsArray[eN,ebN]
10908  * if eN_neighbor >= 0:
10909  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight # <<<<<<<<<<<<<<
10910  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight
10911  * #potential, assumes slight compressibility
10912  */
10913  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 474, __pyx_L1_error)
10914  __Pyx_GOTREF(__pyx_t_2);
10915  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 474, __pyx_L1_error)
10916  __Pyx_GOTREF(__pyx_t_4);
10917  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10918  __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_q_u), __pyx_v_eN_neighbor, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 474, __pyx_L1_error)
10919  __Pyx_GOTREF(__pyx_t_2);
10920  __pyx_t_41 = NULL;
10921  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
10922  __pyx_t_41 = PyMethod_GET_SELF(__pyx_t_4);
10923  if (likely(__pyx_t_41)) {
10924  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
10925  __Pyx_INCREF(__pyx_t_41);
10926  __Pyx_INCREF(function);
10927  __Pyx_DECREF_SET(__pyx_t_4, function);
10928  }
10929  }
10930  if (!__pyx_t_41) {
10931  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error)
10932  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10933  __Pyx_GOTREF(__pyx_t_1);
10934  } else {
10935  #if CYTHON_FAST_PYCALL
10936  if (PyFunction_Check(__pyx_t_4)) {
10937  PyObject *__pyx_temp[2] = {__pyx_t_41, __pyx_t_2};
10938  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error)
10939  __Pyx_XDECREF(__pyx_t_41); __pyx_t_41 = 0;
10940  __Pyx_GOTREF(__pyx_t_1);
10941  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10942  } else
10943  #endif
10944  #if CYTHON_FAST_PYCCALL
10945  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
10946  PyObject *__pyx_temp[2] = {__pyx_t_41, __pyx_t_2};
10947  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error)
10948  __Pyx_XDECREF(__pyx_t_41); __pyx_t_41 = 0;
10949  __Pyx_GOTREF(__pyx_t_1);
10950  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10951  } else
10952  #endif
10953  {
10954  __pyx_t_40 = PyTuple_New(1+1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 474, __pyx_L1_error)
10955  __Pyx_GOTREF(__pyx_t_40);
10956  __Pyx_GIVEREF(__pyx_t_41); PyTuple_SET_ITEM(__pyx_t_40, 0, __pyx_t_41); __pyx_t_41 = NULL;
10957  __Pyx_GIVEREF(__pyx_t_2);
10958  PyTuple_SET_ITEM(__pyx_t_40, 0+1, __pyx_t_2);
10959  __pyx_t_2 = 0;
10960  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_40, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error)
10961  __Pyx_GOTREF(__pyx_t_1);
10962  __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
10963  }
10964  }
10965  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10966  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_nAvgWeight); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 474, __pyx_L1_error)
10967  __Pyx_GOTREF(__pyx_t_4);
10968  __pyx_t_40 = PyNumber_Multiply(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 474, __pyx_L1_error)
10969  __Pyx_GOTREF(__pyx_t_40);
10970  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10971  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10972  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_40); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 474, __pyx_L1_error)
10973  __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
10974  __pyx_v_u_neig = __pyx_t_7;
10975 
10976  /* "subsurfaceTransportFunctions.pyx":475
10977  * if eN_neighbor >= 0:
10978  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight
10979  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight # <<<<<<<<<<<<<<
10980  * #potential, assumes slight compressibility
10981  * phi_neig= u_neig - numpy.dot(gravity,elementBarycentersArray[eN_neighbor])
10982  */
10983  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 475, __pyx_L1_error)
10984  __Pyx_GOTREF(__pyx_t_4);
10985  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 475, __pyx_L1_error)
10986  __Pyx_GOTREF(__pyx_t_1);
10987  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10988  __pyx_t_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_q_kr), __pyx_v_eN_neighbor, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 475, __pyx_L1_error)
10989  __Pyx_GOTREF(__pyx_t_4);
10990  __pyx_t_2 = NULL;
10991  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
10992  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
10993  if (likely(__pyx_t_2)) {
10994  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
10995  __Pyx_INCREF(__pyx_t_2);
10996  __Pyx_INCREF(function);
10997  __Pyx_DECREF_SET(__pyx_t_1, function);
10998  }
10999  }
11000  if (!__pyx_t_2) {
11001  __pyx_t_40 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 475, __pyx_L1_error)
11002  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11003  __Pyx_GOTREF(__pyx_t_40);
11004  } else {
11005  #if CYTHON_FAST_PYCALL
11006  if (PyFunction_Check(__pyx_t_1)) {
11007  PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
11008  __pyx_t_40 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 475, __pyx_L1_error)
11009  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
11010  __Pyx_GOTREF(__pyx_t_40);
11011  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11012  } else
11013  #endif
11014  #if CYTHON_FAST_PYCCALL
11015  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
11016  PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
11017  __pyx_t_40 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 475, __pyx_L1_error)
11018  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
11019  __Pyx_GOTREF(__pyx_t_40);
11020  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11021  } else
11022  #endif
11023  {
11024  __pyx_t_41 = PyTuple_New(1+1); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 475, __pyx_L1_error)
11025  __Pyx_GOTREF(__pyx_t_41);
11026  __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_41, 0, __pyx_t_2); __pyx_t_2 = NULL;
11027  __Pyx_GIVEREF(__pyx_t_4);
11028  PyTuple_SET_ITEM(__pyx_t_41, 0+1, __pyx_t_4);
11029  __pyx_t_4 = 0;
11030  __pyx_t_40 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_41, NULL); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 475, __pyx_L1_error)
11031  __Pyx_GOTREF(__pyx_t_40);
11032  __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
11033  }
11034  }
11035  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11036  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_nAvgWeight); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 475, __pyx_L1_error)
11037  __Pyx_GOTREF(__pyx_t_1);
11038  __pyx_t_41 = PyNumber_Multiply(__pyx_t_40, __pyx_t_1); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 475, __pyx_L1_error)
11039  __Pyx_GOTREF(__pyx_t_41);
11040  __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
11041  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11042  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_41); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 475, __pyx_L1_error)
11043  __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
11044  __pyx_v_kr_neig = __pyx_t_7;
11045 
11046  /* "subsurfaceTransportFunctions.pyx":477
11047  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight
11048  * #potential, assumes slight compressibility
11049  * phi_neig= u_neig - numpy.dot(gravity,elementBarycentersArray[eN_neighbor]) # <<<<<<<<<<<<<<
11050  *
11051  * if phi_eN < phi_neig: #neighbor is upwind
11052  */
11053  __pyx_t_41 = PyFloat_FromDouble(__pyx_v_u_neig); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 477, __pyx_L1_error)
11054  __Pyx_GOTREF(__pyx_t_41);
11055  __pyx_t_40 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 477, __pyx_L1_error)
11056  __Pyx_GOTREF(__pyx_t_40);
11057  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_40, __pyx_n_s_dot); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 477, __pyx_L1_error)
11058  __Pyx_GOTREF(__pyx_t_4);
11059  __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
11060  __pyx_t_40 = __Pyx_GetItemInt(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_v_eN_neighbor, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 477, __pyx_L1_error)
11061  __Pyx_GOTREF(__pyx_t_40);
11062  __pyx_t_2 = NULL;
11063  __pyx_t_15 = 0;
11064  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
11065  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
11066  if (likely(__pyx_t_2)) {
11067  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
11068  __Pyx_INCREF(__pyx_t_2);
11069  __Pyx_INCREF(function);
11070  __Pyx_DECREF_SET(__pyx_t_4, function);
11071  __pyx_t_15 = 1;
11072  }
11073  }
11074  #if CYTHON_FAST_PYCALL
11075  if (PyFunction_Check(__pyx_t_4)) {
11076  PyObject *__pyx_temp[3] = {__pyx_t_2, ((PyObject *)__pyx_v_gravity), __pyx_t_40};
11077  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 477, __pyx_L1_error)
11078  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
11079  __Pyx_GOTREF(__pyx_t_1);
11080  __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
11081  } else
11082  #endif
11083  #if CYTHON_FAST_PYCCALL
11084  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
11085  PyObject *__pyx_temp[3] = {__pyx_t_2, ((PyObject *)__pyx_v_gravity), __pyx_t_40};
11086  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 477, __pyx_L1_error)
11087  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
11088  __Pyx_GOTREF(__pyx_t_1);
11089  __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
11090  } else
11091  #endif
11092  {
11093  __pyx_t_5 = PyTuple_New(2+__pyx_t_15); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 477, __pyx_L1_error)
11094  __Pyx_GOTREF(__pyx_t_5);
11095  if (__pyx_t_2) {
11096  __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
11097  }
11098  __Pyx_INCREF(((PyObject *)__pyx_v_gravity));
11099  __Pyx_GIVEREF(((PyObject *)__pyx_v_gravity));
11100  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_15, ((PyObject *)__pyx_v_gravity));
11101  __Pyx_GIVEREF(__pyx_t_40);
11102  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_15, __pyx_t_40);
11103  __pyx_t_40 = 0;
11104  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 477, __pyx_L1_error)
11105  __Pyx_GOTREF(__pyx_t_1);
11106  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11107  }
11108  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11109  __pyx_t_4 = PyNumber_Subtract(__pyx_t_41, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 477, __pyx_L1_error)
11110  __Pyx_GOTREF(__pyx_t_4);
11111  __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
11112  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11113  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 477, __pyx_L1_error)
11114  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11115  __pyx_v_phi_neig = __pyx_t_7;
11116 
11117  /* "subsurfaceTransportFunctions.pyx":479
11118  * phi_neig= u_neig - numpy.dot(gravity,elementBarycentersArray[eN_neighbor])
11119  *
11120  * if phi_eN < phi_neig: #neighbor is upwind # <<<<<<<<<<<<<<
11121  * q_kr_up[eN,ebN] = kr_neig
11122  *
11123  */
11124  __pyx_t_6 = ((__pyx_v_phi_eN < __pyx_v_phi_neig) != 0);
11125  if (__pyx_t_6) {
11126 
11127  /* "subsurfaceTransportFunctions.pyx":480
11128  *
11129  * if phi_eN < phi_neig: #neighbor is upwind
11130  * q_kr_up[eN,ebN] = kr_neig # <<<<<<<<<<<<<<
11131  *
11132  * #neighbor
11133  */
11134  __pyx_t_46 = __pyx_v_eN;
11135  __pyx_t_47 = __pyx_v_ebN;
11136  __pyx_t_15 = -1;
11137  if (__pyx_t_46 < 0) {
11138  __pyx_t_46 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
11139  if (unlikely(__pyx_t_46 < 0)) __pyx_t_15 = 0;
11140  } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_15 = 0;
11141  if (__pyx_t_47 < 0) {
11142  __pyx_t_47 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
11143  if (unlikely(__pyx_t_47 < 0)) __pyx_t_15 = 1;
11144  } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_15 = 1;
11145  if (unlikely(__pyx_t_15 != -1)) {
11146  __Pyx_RaiseBufferIndexError(__pyx_t_15);
11147  __PYX_ERR(0, 480, __pyx_L1_error)
11148  }
11149  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_q_kr_up.diminfo[1].strides) = __pyx_v_kr_neig;
11150 
11151  /* "subsurfaceTransportFunctions.pyx":479
11152  * phi_neig= u_neig - numpy.dot(gravity,elementBarycentersArray[eN_neighbor])
11153  *
11154  * if phi_eN < phi_neig: #neighbor is upwind # <<<<<<<<<<<<<<
11155  * q_kr_up[eN,ebN] = kr_neig
11156  *
11157  */
11158  }
11159 
11160  /* "subsurfaceTransportFunctions.pyx":473
11161  * q_kr_up[eN,ebN] = kr_eN
11162  * eN_neighbor = elementNeighborsArray[eN,ebN]
11163  * if eN_neighbor >= 0: # <<<<<<<<<<<<<<
11164  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight
11165  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight
11166  */
11167  }
11168  }
11169  }
11170 
11171  /* "subsurfaceTransportFunctions.pyx":359
11172  *
11173  *
11174  * def RE_NCP1_evaluateElementCoefficients_VGM(double rho, # <<<<<<<<<<<<<<
11175  * double beta,
11176  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
11177  */
11178 
11179  /* function exit code */
11180  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11181  goto __pyx_L0;
11182  __pyx_L1_error:;
11183  __Pyx_XDECREF(__pyx_t_1);
11184  __Pyx_XDECREF(__pyx_t_2);
11185  __Pyx_XDECREF(__pyx_t_4);
11186  __Pyx_XDECREF(__pyx_t_5);
11187  __Pyx_XDECREF(__pyx_t_40);
11188  __Pyx_XDECREF(__pyx_t_41);
11189  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
11190  __Pyx_PyThreadState_declare
11191  __Pyx_PyThreadState_assign
11192  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
11193  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alpha.rcbuffer->pybuffer);
11194  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
11195  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
11196  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
11197  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
11198  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer);
11199  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer);
11200  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dmass.rcbuffer->pybuffer);
11201  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
11202  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
11203  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mass.rcbuffer->pybuffer);
11204  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
11205  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
11206  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_x.rcbuffer->pybuffer);
11207  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_thetaR.rcbuffer->pybuffer);
11208  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_thetaSR.rcbuffer->pybuffer);
11209  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u_dof.rcbuffer->pybuffer);
11210  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u_l2g.rcbuffer->pybuffer);
11211  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
11212  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_evaluateElementCoefficients_VGM", __pyx_clineno, __pyx_lineno, __pyx_filename);
11213  __pyx_r = NULL;
11214  goto __pyx_L2;
11215  __pyx_L0:;
11216  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alpha.rcbuffer->pybuffer);
11217  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
11218  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
11219  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
11220  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
11221  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer);
11222  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer);
11223  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dmass.rcbuffer->pybuffer);
11224  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
11225  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
11226  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mass.rcbuffer->pybuffer);
11227  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
11228  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
11229  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_x.rcbuffer->pybuffer);
11230  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_thetaR.rcbuffer->pybuffer);
11231  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_thetaSR.rcbuffer->pybuffer);
11232  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u_dof.rcbuffer->pybuffer);
11233  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u_l2g.rcbuffer->pybuffer);
11234  __pyx_L2:;
11235  __Pyx_XDECREF(__pyx_v_q);
11236  __Pyx_XGIVEREF(__pyx_r);
11237  __Pyx_RefNannyFinishContext();
11238  return __pyx_r;
11239 }
11240 
11241 /* "subsurfaceTransportFunctions.pyx":486
11242  * #eN for upwind
11243  *
11244  * def RE_NCP1_getElementResidual(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
11245  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
11246  * numpy.ndarray[ITYPE_t,ndim=1] colind,
11247  */
11248 
11249 /* Python wrapper */
11250 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11251 static char __pyx_doc_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual[] = "\n residual routine for NCP1 approximation for conservative head formulation of Richards equation \n\n Approximation:\n uses nodal quadrature where the nodes are face barycenters\n uses harmonic average for intrinsic permeability/ hydraulic conductivity\n upwinds relative permeability based on element averages\n applies dirichlet boundary conditions strongly but keeps dofs in system\n\n TODO:\n everything\n \n ";
11252 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual = {"RE_NCP1_getElementResidual", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual};
11253 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11254  CYTHON_UNUSED PyArrayObject *__pyx_v_gravity = 0;
11255  PyArrayObject *__pyx_v_rowptr = 0;
11256  PyArrayObject *__pyx_v_colind = 0;
11257  int __pyx_v_nSpace;
11258  int __pyx_v_nElements_global;
11259  int __pyx_v_nElementBoundaries_element;
11260  CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray = 0;
11261  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray = 0;
11262  int __pyx_v_nDOF_test_element;
11263  PyArrayObject *__pyx_v_q_u = 0;
11264  PyArrayObject *__pyx_v_q_grad_u = 0;
11265  PyArrayObject *__pyx_v_q_grad_w = 0;
11266  PyArrayObject *__pyx_v_q_detJ = 0;
11267  PyArrayObject *__pyx_v_q_m = 0;
11268  PyArrayObject *__pyx_v_q_mt = 0;
11269  PyArrayObject *__pyx_v_q_r = 0;
11270  PyArrayObject *__pyx_v_q_kr = 0;
11271  PyArrayObject *__pyx_v_q_kr_up = 0;
11272  PyArrayObject *__pyx_v_q_flin = 0;
11273  PyArrayObject *__pyx_v_q_alin = 0;
11274  PyArrayObject *__pyx_v_elementResidual = 0;
11275  PyObject *__pyx_r = 0;
11276  __Pyx_RefNannyDeclarations
11277  __Pyx_RefNannySetupContext("RE_NCP1_getElementResidual (wrapper)", 0);
11278  {
11279  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gravity,&__pyx_n_s_rowptr,&__pyx_n_s_colind,&__pyx_n_s_nSpace,&__pyx_n_s_nElements_global,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_nDOF_test_element,&__pyx_n_s_q_u,&__pyx_n_s_q_grad_u,&__pyx_n_s_q_grad_w,&__pyx_n_s_q_detJ,&__pyx_n_s_q_m,&__pyx_n_s_q_mt,&__pyx_n_s_q_r,&__pyx_n_s_q_kr,&__pyx_n_s_q_kr_up,&__pyx_n_s_q_flin,&__pyx_n_s_q_alin,&__pyx_n_s_elementResidual,0};
11280  PyObject* values[21] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
11281  if (unlikely(__pyx_kwds)) {
11282  Py_ssize_t kw_args;
11283  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11284  switch (pos_args) {
11285  case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
11286  case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
11287  case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
11288  case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
11289  case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
11290  case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
11291  case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
11292  case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
11293  case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
11294  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
11295  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
11296  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
11297  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
11298  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
11299  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
11300  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
11301  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11302  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11303  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11304  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11305  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11306  case 0: break;
11307  default: goto __pyx_L5_argtuple_error;
11308  }
11309  kw_args = PyDict_Size(__pyx_kwds);
11310  switch (pos_args) {
11311  case 0:
11312  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--;
11313  else goto __pyx_L5_argtuple_error;
11314  case 1:
11315  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rowptr)) != 0)) kw_args--;
11316  else {
11317  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 1); __PYX_ERR(0, 486, __pyx_L3_error)
11318  }
11319  case 2:
11320  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_colind)) != 0)) kw_args--;
11321  else {
11322  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 2); __PYX_ERR(0, 486, __pyx_L3_error)
11323  }
11324  case 3:
11325  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nSpace)) != 0)) kw_args--;
11326  else {
11327  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 3); __PYX_ERR(0, 486, __pyx_L3_error)
11328  }
11329  case 4:
11330  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
11331  else {
11332  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 4); __PYX_ERR(0, 486, __pyx_L3_error)
11333  }
11334  case 5:
11335  if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
11336  else {
11337  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 5); __PYX_ERR(0, 486, __pyx_L3_error)
11338  }
11339  case 6:
11340  if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
11341  else {
11342  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 6); __PYX_ERR(0, 486, __pyx_L3_error)
11343  }
11344  case 7:
11345  if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
11346  else {
11347  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 7); __PYX_ERR(0, 486, __pyx_L3_error)
11348  }
11349  case 8:
11350  if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nDOF_test_element)) != 0)) kw_args--;
11351  else {
11352  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 8); __PYX_ERR(0, 486, __pyx_L3_error)
11353  }
11354  case 9:
11355  if (likely((values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_u)) != 0)) kw_args--;
11356  else {
11357  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 9); __PYX_ERR(0, 486, __pyx_L3_error)
11358  }
11359  case 10:
11360  if (likely((values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_grad_u)) != 0)) kw_args--;
11361  else {
11362  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 10); __PYX_ERR(0, 486, __pyx_L3_error)
11363  }
11364  case 11:
11365  if (likely((values[11] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_grad_w)) != 0)) kw_args--;
11366  else {
11367  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 11); __PYX_ERR(0, 486, __pyx_L3_error)
11368  }
11369  case 12:
11370  if (likely((values[12] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_detJ)) != 0)) kw_args--;
11371  else {
11372  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 12); __PYX_ERR(0, 486, __pyx_L3_error)
11373  }
11374  case 13:
11375  if (likely((values[13] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_m)) != 0)) kw_args--;
11376  else {
11377  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 13); __PYX_ERR(0, 486, __pyx_L3_error)
11378  }
11379  case 14:
11380  if (likely((values[14] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_mt)) != 0)) kw_args--;
11381  else {
11382  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 14); __PYX_ERR(0, 486, __pyx_L3_error)
11383  }
11384  case 15:
11385  if (likely((values[15] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_r)) != 0)) kw_args--;
11386  else {
11387  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 15); __PYX_ERR(0, 486, __pyx_L3_error)
11388  }
11389  case 16:
11390  if (likely((values[16] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_kr)) != 0)) kw_args--;
11391  else {
11392  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 16); __PYX_ERR(0, 486, __pyx_L3_error)
11393  }
11394  case 17:
11395  if (likely((values[17] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_kr_up)) != 0)) kw_args--;
11396  else {
11397  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 17); __PYX_ERR(0, 486, __pyx_L3_error)
11398  }
11399  case 18:
11400  if (likely((values[18] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_flin)) != 0)) kw_args--;
11401  else {
11402  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 18); __PYX_ERR(0, 486, __pyx_L3_error)
11403  }
11404  case 19:
11405  if (likely((values[19] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_alin)) != 0)) kw_args--;
11406  else {
11407  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 19); __PYX_ERR(0, 486, __pyx_L3_error)
11408  }
11409  case 20:
11410  if (likely((values[20] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementResidual)) != 0)) kw_args--;
11411  else {
11412  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 20); __PYX_ERR(0, 486, __pyx_L3_error)
11413  }
11414  }
11415  if (unlikely(kw_args > 0)) {
11416  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RE_NCP1_getElementResidual") < 0)) __PYX_ERR(0, 486, __pyx_L3_error)
11417  }
11418  } else if (PyTuple_GET_SIZE(__pyx_args) != 21) {
11419  goto __pyx_L5_argtuple_error;
11420  } else {
11421  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11422  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11423  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11424  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11425  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11426  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
11427  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
11428  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
11429  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
11430  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
11431  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
11432  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
11433  values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
11434  values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
11435  values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
11436  values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
11437  values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
11438  values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
11439  values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
11440  values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
11441  values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
11442  }
11443  __pyx_v_gravity = ((PyArrayObject *)values[0]);
11444  __pyx_v_rowptr = ((PyArrayObject *)values[1]);
11445  __pyx_v_colind = ((PyArrayObject *)values[2]);
11446  __pyx_v_nSpace = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nSpace == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 490, __pyx_L3_error)
11447  __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nElements_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 491, __pyx_L3_error)
11448  __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nElementBoundaries_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 492, __pyx_L3_error)
11449  __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[6]);
11450  __pyx_v_elementBarycentersArray = ((PyArrayObject *)values[7]);
11451  __pyx_v_nDOF_test_element = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_nDOF_test_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 496, __pyx_L3_error)
11452  __pyx_v_q_u = ((PyArrayObject *)values[9]);
11453  __pyx_v_q_grad_u = ((PyArrayObject *)values[10]);
11454  __pyx_v_q_grad_w = ((PyArrayObject *)values[11]);
11455  __pyx_v_q_detJ = ((PyArrayObject *)values[12]);
11456  __pyx_v_q_m = ((PyArrayObject *)values[13]);
11457  __pyx_v_q_mt = ((PyArrayObject *)values[14]);
11458  __pyx_v_q_r = ((PyArrayObject *)values[15]);
11459  __pyx_v_q_kr = ((PyArrayObject *)values[16]);
11460  __pyx_v_q_kr_up = ((PyArrayObject *)values[17]);
11461  __pyx_v_q_flin = ((PyArrayObject *)values[18]);
11462  __pyx_v_q_alin = ((PyArrayObject *)values[19]);
11463  __pyx_v_elementResidual = ((PyArrayObject *)values[20]);
11464  }
11465  goto __pyx_L4_argument_unpacking_done;
11466  __pyx_L5_argtuple_error:;
11467  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 486, __pyx_L3_error)
11468  __pyx_L3_error:;
11469  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_getElementResidual", __pyx_clineno, __pyx_lineno, __pyx_filename);
11470  __Pyx_RefNannyFinishContext();
11471  return NULL;
11472  __pyx_L4_argument_unpacking_done:;
11473  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gravity), __pyx_ptype_5numpy_ndarray, 1, "gravity", 0))) __PYX_ERR(0, 486, __pyx_L1_error)
11474  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rowptr), __pyx_ptype_5numpy_ndarray, 1, "rowptr", 0))) __PYX_ERR(0, 487, __pyx_L1_error)
11475  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_colind), __pyx_ptype_5numpy_ndarray, 1, "colind", 0))) __PYX_ERR(0, 488, __pyx_L1_error)
11476  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1, "elementNeighborsArray", 0))) __PYX_ERR(0, 493, __pyx_L1_error)
11477  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_ptype_5numpy_ndarray, 1, "elementBarycentersArray", 0))) __PYX_ERR(0, 494, __pyx_L1_error)
11478  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_u), __pyx_ptype_5numpy_ndarray, 1, "q_u", 0))) __PYX_ERR(0, 497, __pyx_L1_error)
11479  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_u), __pyx_ptype_5numpy_ndarray, 1, "q_grad_u", 0))) __PYX_ERR(0, 498, __pyx_L1_error)
11480  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_w), __pyx_ptype_5numpy_ndarray, 1, "q_grad_w", 0))) __PYX_ERR(0, 499, __pyx_L1_error)
11481  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_detJ), __pyx_ptype_5numpy_ndarray, 1, "q_detJ", 0))) __PYX_ERR(0, 501, __pyx_L1_error)
11482  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_m), __pyx_ptype_5numpy_ndarray, 1, "q_m", 0))) __PYX_ERR(0, 502, __pyx_L1_error)
11483  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_mt), __pyx_ptype_5numpy_ndarray, 1, "q_mt", 0))) __PYX_ERR(0, 503, __pyx_L1_error)
11484  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_r), __pyx_ptype_5numpy_ndarray, 1, "q_r", 0))) __PYX_ERR(0, 504, __pyx_L1_error)
11485  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr), __pyx_ptype_5numpy_ndarray, 1, "q_kr", 0))) __PYX_ERR(0, 505, __pyx_L1_error)
11486  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr_up), __pyx_ptype_5numpy_ndarray, 1, "q_kr_up", 0))) __PYX_ERR(0, 506, __pyx_L1_error)
11487  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_flin), __pyx_ptype_5numpy_ndarray, 1, "q_flin", 0))) __PYX_ERR(0, 509, __pyx_L1_error)
11488  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_alin), __pyx_ptype_5numpy_ndarray, 1, "q_alin", 0))) __PYX_ERR(0, 510, __pyx_L1_error)
11489  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementResidual), __pyx_ptype_5numpy_ndarray, 1, "elementResidual", 0))) __PYX_ERR(0, 512, __pyx_L1_error)
11490  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual(__pyx_self, __pyx_v_gravity, __pyx_v_rowptr, __pyx_v_colind, __pyx_v_nSpace, __pyx_v_nElements_global, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_elementBarycentersArray, __pyx_v_nDOF_test_element, __pyx_v_q_u, __pyx_v_q_grad_u, __pyx_v_q_grad_w, __pyx_v_q_detJ, __pyx_v_q_m, __pyx_v_q_mt, __pyx_v_q_r, __pyx_v_q_kr, __pyx_v_q_kr_up, __pyx_v_q_flin, __pyx_v_q_alin, __pyx_v_elementResidual);
11491 
11492  /* function exit code */
11493  goto __pyx_L0;
11494  __pyx_L1_error:;
11495  __pyx_r = NULL;
11496  __pyx_L0:;
11497  __Pyx_RefNannyFinishContext();
11498  return __pyx_r;
11499 }
11500 
11501 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray, int __pyx_v_nDOF_test_element, PyArrayObject *__pyx_v_q_u, PyArrayObject *__pyx_v_q_grad_u, PyArrayObject *__pyx_v_q_grad_w, PyArrayObject *__pyx_v_q_detJ, PyArrayObject *__pyx_v_q_m, PyArrayObject *__pyx_v_q_mt, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, PyArrayObject *__pyx_v_q_kr_up, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin, PyArrayObject *__pyx_v_elementResidual) {
11502  CYTHON_UNUSED int __pyx_v_upwindFlag;
11503  PyObject *__pyx_v_q = NULL;
11504  int __pyx_v_nnz;
11505  int __pyx_v_eN;
11506  int __pyx_v_ii;
11507  int __pyx_v_I;
11508  int __pyx_v_i;
11509  int __pyx_v_ebN;
11510  PyArrayObject *__pyx_v_a_up = 0;
11511  PyArrayObject *__pyx_v_f_up = 0;
11512  double __pyx_v_nAvgWeight;
11513  double __pyx_v_weight;
11514  double __pyx_v_volFactor;
11515  double __pyx_v_volume;
11516  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_up;
11517  __Pyx_Buffer __pyx_pybuffer_a_up;
11518  __Pyx_LocalBuf_ND __pyx_pybuffernd_colind;
11519  __Pyx_Buffer __pyx_pybuffer_colind;
11520  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBarycentersArray;
11521  __Pyx_Buffer __pyx_pybuffer_elementBarycentersArray;
11522  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementNeighborsArray;
11523  __Pyx_Buffer __pyx_pybuffer_elementNeighborsArray;
11524  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementResidual;
11525  __Pyx_Buffer __pyx_pybuffer_elementResidual;
11526  __Pyx_LocalBuf_ND __pyx_pybuffernd_f_up;
11527  __Pyx_Buffer __pyx_pybuffer_f_up;
11528  __Pyx_LocalBuf_ND __pyx_pybuffernd_gravity;
11529  __Pyx_Buffer __pyx_pybuffer_gravity;
11530  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_alin;
11531  __Pyx_Buffer __pyx_pybuffer_q_alin;
11532  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_detJ;
11533  __Pyx_Buffer __pyx_pybuffer_q_detJ;
11534  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_flin;
11535  __Pyx_Buffer __pyx_pybuffer_q_flin;
11536  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_u;
11537  __Pyx_Buffer __pyx_pybuffer_q_grad_u;
11538  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_w;
11539  __Pyx_Buffer __pyx_pybuffer_q_grad_w;
11540  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr;
11541  __Pyx_Buffer __pyx_pybuffer_q_kr;
11542  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr_up;
11543  __Pyx_Buffer __pyx_pybuffer_q_kr_up;
11544  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_m;
11545  __Pyx_Buffer __pyx_pybuffer_q_m;
11546  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_mt;
11547  __Pyx_Buffer __pyx_pybuffer_q_mt;
11548  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_r;
11549  __Pyx_Buffer __pyx_pybuffer_q_r;
11550  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_u;
11551  __Pyx_Buffer __pyx_pybuffer_q_u;
11552  __Pyx_LocalBuf_ND __pyx_pybuffernd_rowptr;
11553  __Pyx_Buffer __pyx_pybuffer_rowptr;
11554  PyObject *__pyx_r = NULL;
11555  __Pyx_RefNannyDeclarations
11556  PyObject *__pyx_t_1 = NULL;
11557  PyObject *__pyx_t_2 = NULL;
11558  Py_ssize_t __pyx_t_3;
11559  PyObject *__pyx_t_4 = NULL;
11560  PyObject *__pyx_t_5 = NULL;
11561  int __pyx_t_6;
11562  Py_ssize_t __pyx_t_7;
11563  int __pyx_t_8;
11564  PyObject *__pyx_t_9 = NULL;
11565  PyArrayObject *__pyx_t_10 = NULL;
11566  PyArrayObject *__pyx_t_11 = NULL;
11567  double __pyx_t_12;
11568  int __pyx_t_13;
11569  Py_ssize_t __pyx_t_14;
11570  Py_ssize_t __pyx_t_15;
11571  int __pyx_t_16;
11572  int __pyx_t_17;
11573  Py_ssize_t __pyx_t_18;
11574  Py_ssize_t __pyx_t_19;
11575  int __pyx_t_20;
11576  Py_ssize_t __pyx_t_21;
11577  Py_ssize_t __pyx_t_22;
11578  Py_ssize_t __pyx_t_23;
11579  Py_ssize_t __pyx_t_24;
11580  Py_ssize_t __pyx_t_25;
11581  Py_ssize_t __pyx_t_26;
11582  int __pyx_t_27;
11583  int __pyx_t_28;
11584  int __pyx_t_29;
11585  Py_ssize_t __pyx_t_30;
11586  Py_ssize_t __pyx_t_31;
11587  Py_ssize_t __pyx_t_32;
11588  int __pyx_t_33;
11589  Py_ssize_t __pyx_t_34;
11590  Py_ssize_t __pyx_t_35;
11591  Py_ssize_t __pyx_t_36;
11592  Py_ssize_t __pyx_t_37;
11593  Py_ssize_t __pyx_t_38;
11594  Py_ssize_t __pyx_t_39;
11595  Py_ssize_t __pyx_t_40;
11596  Py_ssize_t __pyx_t_41;
11597  Py_ssize_t __pyx_t_42;
11598  Py_ssize_t __pyx_t_43;
11599  Py_ssize_t __pyx_t_44;
11600  Py_ssize_t __pyx_t_45;
11601  Py_ssize_t __pyx_t_46;
11602  Py_ssize_t __pyx_t_47;
11603  Py_ssize_t __pyx_t_48;
11604  Py_ssize_t __pyx_t_49;
11605  Py_ssize_t __pyx_t_50;
11606  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_51;
11607  Py_ssize_t __pyx_t_52;
11608  Py_ssize_t __pyx_t_53;
11609  int __pyx_t_54;
11610  Py_ssize_t __pyx_t_55;
11611  Py_ssize_t __pyx_t_56;
11612  Py_ssize_t __pyx_t_57;
11613  Py_ssize_t __pyx_t_58;
11614  Py_ssize_t __pyx_t_59;
11615  Py_ssize_t __pyx_t_60;
11616  Py_ssize_t __pyx_t_61;
11617  Py_ssize_t __pyx_t_62;
11618  Py_ssize_t __pyx_t_63;
11619  Py_ssize_t __pyx_t_64;
11620  __Pyx_RefNannySetupContext("RE_NCP1_getElementResidual", 0);
11621  __pyx_pybuffer_a_up.pybuffer.buf = NULL;
11622  __pyx_pybuffer_a_up.refcount = 0;
11623  __pyx_pybuffernd_a_up.data = NULL;
11624  __pyx_pybuffernd_a_up.rcbuffer = &__pyx_pybuffer_a_up;
11625  __pyx_pybuffer_f_up.pybuffer.buf = NULL;
11626  __pyx_pybuffer_f_up.refcount = 0;
11627  __pyx_pybuffernd_f_up.data = NULL;
11628  __pyx_pybuffernd_f_up.rcbuffer = &__pyx_pybuffer_f_up;
11629  __pyx_pybuffer_gravity.pybuffer.buf = NULL;
11630  __pyx_pybuffer_gravity.refcount = 0;
11631  __pyx_pybuffernd_gravity.data = NULL;
11632  __pyx_pybuffernd_gravity.rcbuffer = &__pyx_pybuffer_gravity;
11633  __pyx_pybuffer_rowptr.pybuffer.buf = NULL;
11634  __pyx_pybuffer_rowptr.refcount = 0;
11635  __pyx_pybuffernd_rowptr.data = NULL;
11636  __pyx_pybuffernd_rowptr.rcbuffer = &__pyx_pybuffer_rowptr;
11637  __pyx_pybuffer_colind.pybuffer.buf = NULL;
11638  __pyx_pybuffer_colind.refcount = 0;
11639  __pyx_pybuffernd_colind.data = NULL;
11640  __pyx_pybuffernd_colind.rcbuffer = &__pyx_pybuffer_colind;
11641  __pyx_pybuffer_elementNeighborsArray.pybuffer.buf = NULL;
11642  __pyx_pybuffer_elementNeighborsArray.refcount = 0;
11643  __pyx_pybuffernd_elementNeighborsArray.data = NULL;
11644  __pyx_pybuffernd_elementNeighborsArray.rcbuffer = &__pyx_pybuffer_elementNeighborsArray;
11645  __pyx_pybuffer_elementBarycentersArray.pybuffer.buf = NULL;
11646  __pyx_pybuffer_elementBarycentersArray.refcount = 0;
11647  __pyx_pybuffernd_elementBarycentersArray.data = NULL;
11648  __pyx_pybuffernd_elementBarycentersArray.rcbuffer = &__pyx_pybuffer_elementBarycentersArray;
11649  __pyx_pybuffer_q_u.pybuffer.buf = NULL;
11650  __pyx_pybuffer_q_u.refcount = 0;
11651  __pyx_pybuffernd_q_u.data = NULL;
11652  __pyx_pybuffernd_q_u.rcbuffer = &__pyx_pybuffer_q_u;
11653  __pyx_pybuffer_q_grad_u.pybuffer.buf = NULL;
11654  __pyx_pybuffer_q_grad_u.refcount = 0;
11655  __pyx_pybuffernd_q_grad_u.data = NULL;
11656  __pyx_pybuffernd_q_grad_u.rcbuffer = &__pyx_pybuffer_q_grad_u;
11657  __pyx_pybuffer_q_grad_w.pybuffer.buf = NULL;
11658  __pyx_pybuffer_q_grad_w.refcount = 0;
11659  __pyx_pybuffernd_q_grad_w.data = NULL;
11660  __pyx_pybuffernd_q_grad_w.rcbuffer = &__pyx_pybuffer_q_grad_w;
11661  __pyx_pybuffer_q_detJ.pybuffer.buf = NULL;
11662  __pyx_pybuffer_q_detJ.refcount = 0;
11663  __pyx_pybuffernd_q_detJ.data = NULL;
11664  __pyx_pybuffernd_q_detJ.rcbuffer = &__pyx_pybuffer_q_detJ;
11665  __pyx_pybuffer_q_m.pybuffer.buf = NULL;
11666  __pyx_pybuffer_q_m.refcount = 0;
11667  __pyx_pybuffernd_q_m.data = NULL;
11668  __pyx_pybuffernd_q_m.rcbuffer = &__pyx_pybuffer_q_m;
11669  __pyx_pybuffer_q_mt.pybuffer.buf = NULL;
11670  __pyx_pybuffer_q_mt.refcount = 0;
11671  __pyx_pybuffernd_q_mt.data = NULL;
11672  __pyx_pybuffernd_q_mt.rcbuffer = &__pyx_pybuffer_q_mt;
11673  __pyx_pybuffer_q_r.pybuffer.buf = NULL;
11674  __pyx_pybuffer_q_r.refcount = 0;
11675  __pyx_pybuffernd_q_r.data = NULL;
11676  __pyx_pybuffernd_q_r.rcbuffer = &__pyx_pybuffer_q_r;
11677  __pyx_pybuffer_q_kr.pybuffer.buf = NULL;
11678  __pyx_pybuffer_q_kr.refcount = 0;
11679  __pyx_pybuffernd_q_kr.data = NULL;
11680  __pyx_pybuffernd_q_kr.rcbuffer = &__pyx_pybuffer_q_kr;
11681  __pyx_pybuffer_q_kr_up.pybuffer.buf = NULL;
11682  __pyx_pybuffer_q_kr_up.refcount = 0;
11683  __pyx_pybuffernd_q_kr_up.data = NULL;
11684  __pyx_pybuffernd_q_kr_up.rcbuffer = &__pyx_pybuffer_q_kr_up;
11685  __pyx_pybuffer_q_flin.pybuffer.buf = NULL;
11686  __pyx_pybuffer_q_flin.refcount = 0;
11687  __pyx_pybuffernd_q_flin.data = NULL;
11688  __pyx_pybuffernd_q_flin.rcbuffer = &__pyx_pybuffer_q_flin;
11689  __pyx_pybuffer_q_alin.pybuffer.buf = NULL;
11690  __pyx_pybuffer_q_alin.refcount = 0;
11691  __pyx_pybuffernd_q_alin.data = NULL;
11692  __pyx_pybuffernd_q_alin.rcbuffer = &__pyx_pybuffer_q_alin;
11693  __pyx_pybuffer_elementResidual.pybuffer.buf = NULL;
11694  __pyx_pybuffer_elementResidual.refcount = 0;
11695  __pyx_pybuffernd_elementResidual.data = NULL;
11696  __pyx_pybuffernd_elementResidual.rcbuffer = &__pyx_pybuffer_elementResidual;
11697  {
11698  __Pyx_BufFmt_StackElem __pyx_stack[1];
11699  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer, (PyObject*)__pyx_v_gravity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
11700  }
11701  __pyx_pybuffernd_gravity.diminfo[0].strides = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gravity.diminfo[0].shape = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.shape[0];
11702  {
11703  __Pyx_BufFmt_StackElem __pyx_stack[1];
11704  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_rowptr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
11705  }
11706  __pyx_pybuffernd_rowptr.diminfo[0].strides = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rowptr.diminfo[0].shape = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.shape[0];
11707  {
11708  __Pyx_BufFmt_StackElem __pyx_stack[1];
11709  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_colind.rcbuffer->pybuffer, (PyObject*)__pyx_v_colind, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
11710  }
11711  __pyx_pybuffernd_colind.diminfo[0].strides = __pyx_pybuffernd_colind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_colind.diminfo[0].shape = __pyx_pybuffernd_colind.rcbuffer->pybuffer.shape[0];
11712  {
11713  __Pyx_BufFmt_StackElem __pyx_stack[1];
11714  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementNeighborsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
11715  }
11716  __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[1];
11717  {
11718  __Pyx_BufFmt_StackElem __pyx_stack[1];
11719  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBarycentersArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
11720  }
11721  __pyx_pybuffernd_elementBarycentersArray.diminfo[0].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[0].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[1];
11722  {
11723  __Pyx_BufFmt_StackElem __pyx_stack[1];
11724  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
11725  }
11726  __pyx_pybuffernd_q_u.diminfo[0].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_u.diminfo[0].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_u.diminfo[1].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_u.diminfo[1].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[1];
11727  {
11728  __Pyx_BufFmt_StackElem __pyx_stack[1];
11729  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
11730  }
11731  __pyx_pybuffernd_q_grad_u.diminfo[0].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_u.diminfo[0].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_u.diminfo[1].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_u.diminfo[1].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_u.diminfo[2].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_u.diminfo[2].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[2];
11732  {
11733  __Pyx_BufFmt_StackElem __pyx_stack[1];
11734  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_w, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
11735  }
11736  __pyx_pybuffernd_q_grad_w.diminfo[0].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_w.diminfo[0].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_w.diminfo[1].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_w.diminfo[1].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_w.diminfo[2].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_w.diminfo[2].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_q_grad_w.diminfo[3].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_q_grad_w.diminfo[3].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[3];
11737  {
11738  __Pyx_BufFmt_StackElem __pyx_stack[1];
11739  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_detJ, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
11740  }
11741  __pyx_pybuffernd_q_detJ.diminfo[0].strides = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_detJ.diminfo[0].shape = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_detJ.diminfo[1].strides = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_detJ.diminfo[1].shape = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.shape[1];
11742  {
11743  __Pyx_BufFmt_StackElem __pyx_stack[1];
11744  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_m, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
11745  }
11746  __pyx_pybuffernd_q_m.diminfo[0].strides = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_m.diminfo[0].shape = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_m.diminfo[1].strides = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_m.diminfo[1].shape = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.shape[1];
11747  {
11748  __Pyx_BufFmt_StackElem __pyx_stack[1];
11749  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_mt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
11750  }
11751  __pyx_pybuffernd_q_mt.diminfo[0].strides = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_mt.diminfo[0].shape = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_mt.diminfo[1].strides = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_mt.diminfo[1].shape = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.shape[1];
11752  {
11753  __Pyx_BufFmt_StackElem __pyx_stack[1];
11754  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_r, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
11755  }
11756  __pyx_pybuffernd_q_r.diminfo[0].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_r.diminfo[0].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_r.diminfo[1].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_r.diminfo[1].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[1];
11757  {
11758  __Pyx_BufFmt_StackElem __pyx_stack[1];
11759  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
11760  }
11761  __pyx_pybuffernd_q_kr.diminfo[0].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr.diminfo[0].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr.diminfo[1].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr.diminfo[1].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[1];
11762  {
11763  __Pyx_BufFmt_StackElem __pyx_stack[1];
11764  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr_up, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
11765  }
11766  __pyx_pybuffernd_q_kr_up.diminfo[0].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr_up.diminfo[0].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr_up.diminfo[1].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr_up.diminfo[1].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[1];
11767  {
11768  __Pyx_BufFmt_StackElem __pyx_stack[1];
11769  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_flin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
11770  }
11771  __pyx_pybuffernd_q_flin.diminfo[0].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_flin.diminfo[0].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_flin.diminfo[1].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_flin.diminfo[1].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_flin.diminfo[2].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_flin.diminfo[2].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[2];
11772  {
11773  __Pyx_BufFmt_StackElem __pyx_stack[1];
11774  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_alin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
11775  }
11776  __pyx_pybuffernd_q_alin.diminfo[0].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_alin.diminfo[0].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_alin.diminfo[1].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_alin.diminfo[1].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_alin.diminfo[2].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_alin.diminfo[2].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[2];
11777  {
11778  __Pyx_BufFmt_StackElem __pyx_stack[1];
11779  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementResidual.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementResidual, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
11780  }
11781  __pyx_pybuffernd_elementResidual.diminfo[0].strides = __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementResidual.diminfo[0].shape = __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementResidual.diminfo[1].strides = __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementResidual.diminfo[1].shape = __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.shape[1];
11782 
11783  /* "subsurfaceTransportFunctions.pyx":527
11784  *
11785  * """
11786  * cdef int upwindFlag = 1 # <<<<<<<<<<<<<<
11787  * #check some sizes
11788  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
11789  */
11790  __pyx_v_upwindFlag = 1;
11791 
11792  /* "subsurfaceTransportFunctions.pyx":529
11793  * cdef int upwindFlag = 1
11794  * #check some sizes
11795  * for q in [q_u,q_m,q_mt,q_r,q_kr]: # <<<<<<<<<<<<<<
11796  * assert q.shape[1] == nSpace+1
11797  * assert nDOF_test_element == nSpace+1
11798  */
11799  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error)
11800  __Pyx_GOTREF(__pyx_t_1);
11801  __Pyx_INCREF(((PyObject *)__pyx_v_q_u));
11802  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_u));
11803  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_q_u));
11804  __Pyx_INCREF(((PyObject *)__pyx_v_q_m));
11805  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_m));
11806  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_q_m));
11807  __Pyx_INCREF(((PyObject *)__pyx_v_q_mt));
11808  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_mt));
11809  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_q_mt));
11810  __Pyx_INCREF(((PyObject *)__pyx_v_q_r));
11811  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_r));
11812  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_q_r));
11813  __Pyx_INCREF(((PyObject *)__pyx_v_q_kr));
11814  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_kr));
11815  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_q_kr));
11816  __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
11817  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11818  for (;;) {
11819  if (__pyx_t_3 >= 5) break;
11820  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11821  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 529, __pyx_L1_error)
11822  #else
11823  __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error)
11824  __Pyx_GOTREF(__pyx_t_1);
11825  #endif
11826  __Pyx_XDECREF_SET(__pyx_v_q, __pyx_t_1);
11827  __pyx_t_1 = 0;
11828 
11829  /* "subsurfaceTransportFunctions.pyx":530
11830  * #check some sizes
11831  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
11832  * assert q.shape[1] == nSpace+1 # <<<<<<<<<<<<<<
11833  * assert nDOF_test_element == nSpace+1
11834  * cdef int nnz = rowptr[nSpace]
11835  */
11836  #ifndef CYTHON_WITHOUT_ASSERTIONS
11837  if (unlikely(!Py_OptimizeFlag)) {
11838  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_q, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error)
11839  __Pyx_GOTREF(__pyx_t_1);
11840  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 530, __pyx_L1_error)
11841  __Pyx_GOTREF(__pyx_t_4);
11842  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11843  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_nSpace + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error)
11844  __Pyx_GOTREF(__pyx_t_1);
11845  __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 530, __pyx_L1_error)
11846  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11847  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11848  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 530, __pyx_L1_error)
11849  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11850  if (unlikely(!__pyx_t_6)) {
11851  PyErr_SetNone(PyExc_AssertionError);
11852  __PYX_ERR(0, 530, __pyx_L1_error)
11853  }
11854  }
11855  #endif
11856 
11857  /* "subsurfaceTransportFunctions.pyx":529
11858  * cdef int upwindFlag = 1
11859  * #check some sizes
11860  * for q in [q_u,q_m,q_mt,q_r,q_kr]: # <<<<<<<<<<<<<<
11861  * assert q.shape[1] == nSpace+1
11862  * assert nDOF_test_element == nSpace+1
11863  */
11864  }
11865  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11866 
11867  /* "subsurfaceTransportFunctions.pyx":531
11868  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
11869  * assert q.shape[1] == nSpace+1
11870  * assert nDOF_test_element == nSpace+1 # <<<<<<<<<<<<<<
11871  * cdef int nnz = rowptr[nSpace]
11872  * #temporaries
11873  */
11874  #ifndef CYTHON_WITHOUT_ASSERTIONS
11875  if (unlikely(!Py_OptimizeFlag)) {
11876  if (unlikely(!((__pyx_v_nDOF_test_element == (__pyx_v_nSpace + 1)) != 0))) {
11877  PyErr_SetNone(PyExc_AssertionError);
11878  __PYX_ERR(0, 531, __pyx_L1_error)
11879  }
11880  }
11881  #endif
11882 
11883  /* "subsurfaceTransportFunctions.pyx":532
11884  * assert q.shape[1] == nSpace+1
11885  * assert nDOF_test_element == nSpace+1
11886  * cdef int nnz = rowptr[nSpace] # <<<<<<<<<<<<<<
11887  * #temporaries
11888  * cdef double u_eN,kr_eN,phi_eN,u_neig,kr_neig,phi_neig
11889  */
11890  __pyx_t_7 = __pyx_v_nSpace;
11891  __pyx_t_8 = -1;
11892  if (__pyx_t_7 < 0) {
11893  __pyx_t_7 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
11894  if (unlikely(__pyx_t_7 < 0)) __pyx_t_8 = 0;
11895  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_8 = 0;
11896  if (unlikely(__pyx_t_8 != -1)) {
11897  __Pyx_RaiseBufferIndexError(__pyx_t_8);
11898  __PYX_ERR(0, 532, __pyx_L1_error)
11899  }
11900  __pyx_v_nnz = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_rowptr.diminfo[0].strides));
11901 
11902  /* "subsurfaceTransportFunctions.pyx":536
11903  * cdef double u_eN,kr_eN,phi_eN,u_neig,kr_neig,phi_neig
11904  * cdef int eN,eN_neighbor,ii,I,i,ebN
11905  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_up= numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
11906  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d')
11907  * #for averaging/integration weights
11908  */
11909  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 536, __pyx_L1_error)
11910  __Pyx_GOTREF(__pyx_t_5);
11911  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 536, __pyx_L1_error)
11912  __Pyx_GOTREF(__pyx_t_1);
11913  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11914  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 536, __pyx_L1_error)
11915  __Pyx_GOTREF(__pyx_t_5);
11916  __pyx_t_4 = NULL;
11917  __pyx_t_8 = 0;
11918  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
11919  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
11920  if (likely(__pyx_t_4)) {
11921  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
11922  __Pyx_INCREF(__pyx_t_4);
11923  __Pyx_INCREF(function);
11924  __Pyx_DECREF_SET(__pyx_t_1, function);
11925  __pyx_t_8 = 1;
11926  }
11927  }
11928  #if CYTHON_FAST_PYCALL
11929  if (PyFunction_Check(__pyx_t_1)) {
11930  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
11931  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 536, __pyx_L1_error)
11932  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
11933  __Pyx_GOTREF(__pyx_t_2);
11934  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11935  } else
11936  #endif
11937  #if CYTHON_FAST_PYCCALL
11938  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
11939  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
11940  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 536, __pyx_L1_error)
11941  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
11942  __Pyx_GOTREF(__pyx_t_2);
11943  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11944  } else
11945  #endif
11946  {
11947  __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 536, __pyx_L1_error)
11948  __Pyx_GOTREF(__pyx_t_9);
11949  if (__pyx_t_4) {
11950  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL;
11951  }
11952  __Pyx_GIVEREF(__pyx_t_5);
11953  PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_5);
11954  __Pyx_INCREF(__pyx_n_s_d);
11955  __Pyx_GIVEREF(__pyx_n_s_d);
11956  PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_n_s_d);
11957  __pyx_t_5 = 0;
11958  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 536, __pyx_L1_error)
11959  __Pyx_GOTREF(__pyx_t_2);
11960  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
11961  }
11962  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11963  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 536, __pyx_L1_error)
11964  __pyx_t_10 = ((PyArrayObject *)__pyx_t_2);
11965  {
11966  __Pyx_BufFmt_StackElem __pyx_stack[1];
11967  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
11968  __pyx_v_a_up = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf = NULL;
11969  __PYX_ERR(0, 536, __pyx_L1_error)
11970  } else {__pyx_pybuffernd_a_up.diminfo[0].strides = __pyx_pybuffernd_a_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_up.diminfo[0].shape = __pyx_pybuffernd_a_up.rcbuffer->pybuffer.shape[0];
11971  }
11972  }
11973  __pyx_t_10 = 0;
11974  __pyx_v_a_up = ((PyArrayObject *)__pyx_t_2);
11975  __pyx_t_2 = 0;
11976 
11977  /* "subsurfaceTransportFunctions.pyx":537
11978  * cdef int eN,eN_neighbor,ii,I,i,ebN
11979  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_up= numpy.zeros(nnz,'d')
11980  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d') # <<<<<<<<<<<<<<
11981  * #for averaging/integration weights
11982  * cdef double nAvgWeight = 1.0/(nSpace+1.)
11983  */
11984  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error)
11985  __Pyx_GOTREF(__pyx_t_1);
11986  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 537, __pyx_L1_error)
11987  __Pyx_GOTREF(__pyx_t_9);
11988  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11989  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nSpace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error)
11990  __Pyx_GOTREF(__pyx_t_1);
11991  __pyx_t_5 = NULL;
11992  __pyx_t_8 = 0;
11993  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
11994  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
11995  if (likely(__pyx_t_5)) {
11996  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
11997  __Pyx_INCREF(__pyx_t_5);
11998  __Pyx_INCREF(function);
11999  __Pyx_DECREF_SET(__pyx_t_9, function);
12000  __pyx_t_8 = 1;
12001  }
12002  }
12003  #if CYTHON_FAST_PYCALL
12004  if (PyFunction_Check(__pyx_t_9)) {
12005  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_n_s_d};
12006  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 537, __pyx_L1_error)
12007  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12008  __Pyx_GOTREF(__pyx_t_2);
12009  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12010  } else
12011  #endif
12012  #if CYTHON_FAST_PYCCALL
12013  if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
12014  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_n_s_d};
12015  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 537, __pyx_L1_error)
12016  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12017  __Pyx_GOTREF(__pyx_t_2);
12018  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12019  } else
12020  #endif
12021  {
12022  __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 537, __pyx_L1_error)
12023  __Pyx_GOTREF(__pyx_t_4);
12024  if (__pyx_t_5) {
12025  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
12026  }
12027  __Pyx_GIVEREF(__pyx_t_1);
12028  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_t_1);
12029  __Pyx_INCREF(__pyx_n_s_d);
12030  __Pyx_GIVEREF(__pyx_n_s_d);
12031  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_n_s_d);
12032  __pyx_t_1 = 0;
12033  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 537, __pyx_L1_error)
12034  __Pyx_GOTREF(__pyx_t_2);
12035  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12036  }
12037  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12038  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 537, __pyx_L1_error)
12039  __pyx_t_11 = ((PyArrayObject *)__pyx_t_2);
12040  {
12041  __Pyx_BufFmt_StackElem __pyx_stack[1];
12042  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
12043  __pyx_v_f_up = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf = NULL;
12044  __PYX_ERR(0, 537, __pyx_L1_error)
12045  } else {__pyx_pybuffernd_f_up.diminfo[0].strides = __pyx_pybuffernd_f_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_f_up.diminfo[0].shape = __pyx_pybuffernd_f_up.rcbuffer->pybuffer.shape[0];
12046  }
12047  }
12048  __pyx_t_11 = 0;
12049  __pyx_v_f_up = ((PyArrayObject *)__pyx_t_2);
12050  __pyx_t_2 = 0;
12051 
12052  /* "subsurfaceTransportFunctions.pyx":539
12053  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d')
12054  * #for averaging/integration weights
12055  * cdef double nAvgWeight = 1.0/(nSpace+1.) # <<<<<<<<<<<<<<
12056  * cdef double weight=1.0,volFactor = 1.0
12057  * if nSpace == 2:
12058  */
12059  __pyx_t_12 = (__pyx_v_nSpace + 1.);
12060  if (unlikely(__pyx_t_12 == 0)) {
12061  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
12062  __PYX_ERR(0, 539, __pyx_L1_error)
12063  }
12064  __pyx_v_nAvgWeight = (1.0 / __pyx_t_12);
12065 
12066  /* "subsurfaceTransportFunctions.pyx":540
12067  * #for averaging/integration weights
12068  * cdef double nAvgWeight = 1.0/(nSpace+1.)
12069  * cdef double weight=1.0,volFactor = 1.0 # <<<<<<<<<<<<<<
12070  * if nSpace == 2:
12071  * volFactor = 0.5
12072  */
12073  __pyx_v_weight = 1.0;
12074  __pyx_v_volFactor = 1.0;
12075 
12076  /* "subsurfaceTransportFunctions.pyx":541
12077  * cdef double nAvgWeight = 1.0/(nSpace+1.)
12078  * cdef double weight=1.0,volFactor = 1.0
12079  * if nSpace == 2: # <<<<<<<<<<<<<<
12080  * volFactor = 0.5
12081  * if nSpace == 3:
12082  */
12083  __pyx_t_6 = ((__pyx_v_nSpace == 2) != 0);
12084  if (__pyx_t_6) {
12085 
12086  /* "subsurfaceTransportFunctions.pyx":542
12087  * cdef double weight=1.0,volFactor = 1.0
12088  * if nSpace == 2:
12089  * volFactor = 0.5 # <<<<<<<<<<<<<<
12090  * if nSpace == 3:
12091  * volFactor = 1.0/6.0
12092  */
12093  __pyx_v_volFactor = 0.5;
12094 
12095  /* "subsurfaceTransportFunctions.pyx":541
12096  * cdef double nAvgWeight = 1.0/(nSpace+1.)
12097  * cdef double weight=1.0,volFactor = 1.0
12098  * if nSpace == 2: # <<<<<<<<<<<<<<
12099  * volFactor = 0.5
12100  * if nSpace == 3:
12101  */
12102  }
12103 
12104  /* "subsurfaceTransportFunctions.pyx":543
12105  * if nSpace == 2:
12106  * volFactor = 0.5
12107  * if nSpace == 3: # <<<<<<<<<<<<<<
12108  * volFactor = 1.0/6.0
12109  * #
12110  */
12111  __pyx_t_6 = ((__pyx_v_nSpace == 3) != 0);
12112  if (__pyx_t_6) {
12113 
12114  /* "subsurfaceTransportFunctions.pyx":544
12115  * volFactor = 0.5
12116  * if nSpace == 3:
12117  * volFactor = 1.0/6.0 # <<<<<<<<<<<<<<
12118  * #
12119  * for eN in range(nElements_global):
12120  */
12121  __pyx_v_volFactor = (1.0 / 6.0);
12122 
12123  /* "subsurfaceTransportFunctions.pyx":543
12124  * if nSpace == 2:
12125  * volFactor = 0.5
12126  * if nSpace == 3: # <<<<<<<<<<<<<<
12127  * volFactor = 1.0/6.0
12128  * #
12129  */
12130  }
12131 
12132  /* "subsurfaceTransportFunctions.pyx":546
12133  * volFactor = 1.0/6.0
12134  * #
12135  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
12136  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation
12137  * weight = nAvgWeight*volume
12138  */
12139  __pyx_t_8 = __pyx_v_nElements_global;
12140  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_8; __pyx_t_13+=1) {
12141  __pyx_v_eN = __pyx_t_13;
12142 
12143  /* "subsurfaceTransportFunctions.pyx":547
12144  * #
12145  * for eN in range(nElements_global):
12146  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation # <<<<<<<<<<<<<<
12147  * weight = nAvgWeight*volume
12148  *
12149  */
12150  __pyx_t_14 = __pyx_v_eN;
12151  __pyx_t_15 = 0;
12152  __pyx_t_16 = -1;
12153  if (__pyx_t_14 < 0) {
12154  __pyx_t_14 += __pyx_pybuffernd_q_detJ.diminfo[0].shape;
12155  if (unlikely(__pyx_t_14 < 0)) __pyx_t_16 = 0;
12156  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_q_detJ.diminfo[0].shape)) __pyx_t_16 = 0;
12157  if (__pyx_t_15 < 0) {
12158  __pyx_t_15 += __pyx_pybuffernd_q_detJ.diminfo[1].shape;
12159  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
12160  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_detJ.diminfo[1].shape)) __pyx_t_16 = 1;
12161  if (unlikely(__pyx_t_16 != -1)) {
12162  __Pyx_RaiseBufferIndexError(__pyx_t_16);
12163  __PYX_ERR(0, 547, __pyx_L1_error)
12164  }
12165  __pyx_v_volume = (__pyx_v_volFactor * fabs((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_q_detJ.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_detJ.diminfo[1].strides))));
12166 
12167  /* "subsurfaceTransportFunctions.pyx":548
12168  * for eN in range(nElements_global):
12169  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation
12170  * weight = nAvgWeight*volume # <<<<<<<<<<<<<<
12171  *
12172  * for i in range(nDOF_test_element):
12173  */
12174  __pyx_v_weight = (__pyx_v_nAvgWeight * __pyx_v_volume);
12175 
12176  /* "subsurfaceTransportFunctions.pyx":550
12177  * weight = nAvgWeight*volume
12178  *
12179  * for i in range(nDOF_test_element): # <<<<<<<<<<<<<<
12180  * #nodal quadrature so diagonal
12181  * ##mass
12182  */
12183  __pyx_t_16 = __pyx_v_nDOF_test_element;
12184  for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
12185  __pyx_v_i = __pyx_t_17;
12186 
12187  /* "subsurfaceTransportFunctions.pyx":553
12188  * #nodal quadrature so diagonal
12189  * ##mass
12190  * elementResidual[eN,i] += weight*q_mt[eN,i] # <<<<<<<<<<<<<<
12191  * ##sources
12192  * elementResidual[eN,i] += weight*q_r[eN,i]
12193  */
12194  __pyx_t_18 = __pyx_v_eN;
12195  __pyx_t_19 = __pyx_v_i;
12196  __pyx_t_20 = -1;
12197  if (__pyx_t_18 < 0) {
12198  __pyx_t_18 += __pyx_pybuffernd_q_mt.diminfo[0].shape;
12199  if (unlikely(__pyx_t_18 < 0)) __pyx_t_20 = 0;
12200  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_q_mt.diminfo[0].shape)) __pyx_t_20 = 0;
12201  if (__pyx_t_19 < 0) {
12202  __pyx_t_19 += __pyx_pybuffernd_q_mt.diminfo[1].shape;
12203  if (unlikely(__pyx_t_19 < 0)) __pyx_t_20 = 1;
12204  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_q_mt.diminfo[1].shape)) __pyx_t_20 = 1;
12205  if (unlikely(__pyx_t_20 != -1)) {
12206  __Pyx_RaiseBufferIndexError(__pyx_t_20);
12207  __PYX_ERR(0, 553, __pyx_L1_error)
12208  }
12209  __pyx_t_21 = __pyx_v_eN;
12210  __pyx_t_22 = __pyx_v_i;
12211  __pyx_t_20 = -1;
12212  if (__pyx_t_21 < 0) {
12213  __pyx_t_21 += __pyx_pybuffernd_elementResidual.diminfo[0].shape;
12214  if (unlikely(__pyx_t_21 < 0)) __pyx_t_20 = 0;
12215  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_elementResidual.diminfo[0].shape)) __pyx_t_20 = 0;
12216  if (__pyx_t_22 < 0) {
12217  __pyx_t_22 += __pyx_pybuffernd_elementResidual.diminfo[1].shape;
12218  if (unlikely(__pyx_t_22 < 0)) __pyx_t_20 = 1;
12219  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_elementResidual.diminfo[1].shape)) __pyx_t_20 = 1;
12220  if (unlikely(__pyx_t_20 != -1)) {
12221  __Pyx_RaiseBufferIndexError(__pyx_t_20);
12222  __PYX_ERR(0, 553, __pyx_L1_error)
12223  }
12224  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_elementResidual.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_elementResidual.diminfo[1].strides) += (__pyx_v_weight * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_q_mt.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_q_mt.diminfo[1].strides)));
12225 
12226  /* "subsurfaceTransportFunctions.pyx":555
12227  * elementResidual[eN,i] += weight*q_mt[eN,i]
12228  * ##sources
12229  * elementResidual[eN,i] += weight*q_r[eN,i] # <<<<<<<<<<<<<<
12230  *
12231  * #have to actually compute loop over other nodes for stiffness terms
12232  */
12233  __pyx_t_23 = __pyx_v_eN;
12234  __pyx_t_24 = __pyx_v_i;
12235  __pyx_t_20 = -1;
12236  if (__pyx_t_23 < 0) {
12237  __pyx_t_23 += __pyx_pybuffernd_q_r.diminfo[0].shape;
12238  if (unlikely(__pyx_t_23 < 0)) __pyx_t_20 = 0;
12239  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_q_r.diminfo[0].shape)) __pyx_t_20 = 0;
12240  if (__pyx_t_24 < 0) {
12241  __pyx_t_24 += __pyx_pybuffernd_q_r.diminfo[1].shape;
12242  if (unlikely(__pyx_t_24 < 0)) __pyx_t_20 = 1;
12243  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_q_r.diminfo[1].shape)) __pyx_t_20 = 1;
12244  if (unlikely(__pyx_t_20 != -1)) {
12245  __Pyx_RaiseBufferIndexError(__pyx_t_20);
12246  __PYX_ERR(0, 555, __pyx_L1_error)
12247  }
12248  __pyx_t_25 = __pyx_v_eN;
12249  __pyx_t_26 = __pyx_v_i;
12250  __pyx_t_20 = -1;
12251  if (__pyx_t_25 < 0) {
12252  __pyx_t_25 += __pyx_pybuffernd_elementResidual.diminfo[0].shape;
12253  if (unlikely(__pyx_t_25 < 0)) __pyx_t_20 = 0;
12254  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_elementResidual.diminfo[0].shape)) __pyx_t_20 = 0;
12255  if (__pyx_t_26 < 0) {
12256  __pyx_t_26 += __pyx_pybuffernd_elementResidual.diminfo[1].shape;
12257  if (unlikely(__pyx_t_26 < 0)) __pyx_t_20 = 1;
12258  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_elementResidual.diminfo[1].shape)) __pyx_t_20 = 1;
12259  if (unlikely(__pyx_t_20 != -1)) {
12260  __Pyx_RaiseBufferIndexError(__pyx_t_20);
12261  __PYX_ERR(0, 555, __pyx_L1_error)
12262  }
12263  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_elementResidual.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_elementResidual.diminfo[1].strides) += (__pyx_v_weight * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_r.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_q_r.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_q_r.diminfo[1].strides)));
12264 
12265  /* "subsurfaceTransportFunctions.pyx":558
12266  *
12267  * #have to actually compute loop over other nodes for stiffness terms
12268  * for ebN in range(nElementBoundaries_element): #same as nDOF_trial , nElementBoundaries_ # <<<<<<<<<<<<<<
12269  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
12270  * for ii in range(nnz):
12271  */
12272  __pyx_t_20 = __pyx_v_nElementBoundaries_element;
12273  for (__pyx_t_27 = 0; __pyx_t_27 < __pyx_t_20; __pyx_t_27+=1) {
12274  __pyx_v_ebN = __pyx_t_27;
12275 
12276  /* "subsurfaceTransportFunctions.pyx":560
12277  * for ebN in range(nElementBoundaries_element): #same as nDOF_trial , nElementBoundaries_
12278  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
12279  * for ii in range(nnz): # <<<<<<<<<<<<<<
12280  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
12281  * for I in range(nSpace):
12282  */
12283  __pyx_t_28 = __pyx_v_nnz;
12284  for (__pyx_t_29 = 0; __pyx_t_29 < __pyx_t_28; __pyx_t_29+=1) {
12285  __pyx_v_ii = __pyx_t_29;
12286 
12287  /* "subsurfaceTransportFunctions.pyx":561
12288  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
12289  * for ii in range(nnz):
12290  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN] # <<<<<<<<<<<<<<
12291  * for I in range(nSpace):
12292  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN]
12293  */
12294  __pyx_t_30 = __pyx_v_eN;
12295  __pyx_t_31 = __pyx_v_ebN;
12296  __pyx_t_32 = __pyx_v_ii;
12297  __pyx_t_33 = -1;
12298  if (__pyx_t_30 < 0) {
12299  __pyx_t_30 += __pyx_pybuffernd_q_alin.diminfo[0].shape;
12300  if (unlikely(__pyx_t_30 < 0)) __pyx_t_33 = 0;
12301  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_q_alin.diminfo[0].shape)) __pyx_t_33 = 0;
12302  if (__pyx_t_31 < 0) {
12303  __pyx_t_31 += __pyx_pybuffernd_q_alin.diminfo[1].shape;
12304  if (unlikely(__pyx_t_31 < 0)) __pyx_t_33 = 1;
12305  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_q_alin.diminfo[1].shape)) __pyx_t_33 = 1;
12306  if (__pyx_t_32 < 0) {
12307  __pyx_t_32 += __pyx_pybuffernd_q_alin.diminfo[2].shape;
12308  if (unlikely(__pyx_t_32 < 0)) __pyx_t_33 = 2;
12309  } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_q_alin.diminfo[2].shape)) __pyx_t_33 = 2;
12310  if (unlikely(__pyx_t_33 != -1)) {
12311  __Pyx_RaiseBufferIndexError(__pyx_t_33);
12312  __PYX_ERR(0, 561, __pyx_L1_error)
12313  }
12314  __pyx_t_34 = __pyx_v_eN;
12315  __pyx_t_35 = __pyx_v_ebN;
12316  __pyx_t_33 = -1;
12317  if (__pyx_t_34 < 0) {
12318  __pyx_t_34 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
12319  if (unlikely(__pyx_t_34 < 0)) __pyx_t_33 = 0;
12320  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_33 = 0;
12321  if (__pyx_t_35 < 0) {
12322  __pyx_t_35 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
12323  if (unlikely(__pyx_t_35 < 0)) __pyx_t_33 = 1;
12324  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_33 = 1;
12325  if (unlikely(__pyx_t_33 != -1)) {
12326  __Pyx_RaiseBufferIndexError(__pyx_t_33);
12327  __PYX_ERR(0, 561, __pyx_L1_error)
12328  }
12329  __pyx_t_36 = __pyx_v_ii;
12330  __pyx_t_33 = -1;
12331  if (__pyx_t_36 < 0) {
12332  __pyx_t_36 += __pyx_pybuffernd_a_up.diminfo[0].shape;
12333  if (unlikely(__pyx_t_36 < 0)) __pyx_t_33 = 0;
12334  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_a_up.diminfo[0].shape)) __pyx_t_33 = 0;
12335  if (unlikely(__pyx_t_33 != -1)) {
12336  __Pyx_RaiseBufferIndexError(__pyx_t_33);
12337  __PYX_ERR(0, 561, __pyx_L1_error)
12338  }
12339  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_a_up.diminfo[0].strides) = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_q_alin.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_q_alin.diminfo[1].strides, __pyx_t_32, __pyx_pybuffernd_q_alin.diminfo[2].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_q_kr_up.diminfo[1].strides)));
12340  }
12341 
12342  /* "subsurfaceTransportFunctions.pyx":562
12343  * for ii in range(nnz):
12344  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
12345  * for I in range(nSpace): # <<<<<<<<<<<<<<
12346  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN]
12347  * #
12348  */
12349  __pyx_t_28 = __pyx_v_nSpace;
12350  for (__pyx_t_29 = 0; __pyx_t_29 < __pyx_t_28; __pyx_t_29+=1) {
12351  __pyx_v_I = __pyx_t_29;
12352 
12353  /* "subsurfaceTransportFunctions.pyx":563
12354  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
12355  * for I in range(nSpace):
12356  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN] # <<<<<<<<<<<<<<
12357  * #
12358  * #accumulate advection and stiffness contributions
12359  */
12360  __pyx_t_37 = __pyx_v_eN;
12361  __pyx_t_38 = __pyx_v_ebN;
12362  __pyx_t_39 = __pyx_v_I;
12363  __pyx_t_33 = -1;
12364  if (__pyx_t_37 < 0) {
12365  __pyx_t_37 += __pyx_pybuffernd_q_flin.diminfo[0].shape;
12366  if (unlikely(__pyx_t_37 < 0)) __pyx_t_33 = 0;
12367  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_q_flin.diminfo[0].shape)) __pyx_t_33 = 0;
12368  if (__pyx_t_38 < 0) {
12369  __pyx_t_38 += __pyx_pybuffernd_q_flin.diminfo[1].shape;
12370  if (unlikely(__pyx_t_38 < 0)) __pyx_t_33 = 1;
12371  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_q_flin.diminfo[1].shape)) __pyx_t_33 = 1;
12372  if (__pyx_t_39 < 0) {
12373  __pyx_t_39 += __pyx_pybuffernd_q_flin.diminfo[2].shape;
12374  if (unlikely(__pyx_t_39 < 0)) __pyx_t_33 = 2;
12375  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_q_flin.diminfo[2].shape)) __pyx_t_33 = 2;
12376  if (unlikely(__pyx_t_33 != -1)) {
12377  __Pyx_RaiseBufferIndexError(__pyx_t_33);
12378  __PYX_ERR(0, 563, __pyx_L1_error)
12379  }
12380  __pyx_t_40 = __pyx_v_eN;
12381  __pyx_t_41 = __pyx_v_ebN;
12382  __pyx_t_33 = -1;
12383  if (__pyx_t_40 < 0) {
12384  __pyx_t_40 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
12385  if (unlikely(__pyx_t_40 < 0)) __pyx_t_33 = 0;
12386  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_33 = 0;
12387  if (__pyx_t_41 < 0) {
12388  __pyx_t_41 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
12389  if (unlikely(__pyx_t_41 < 0)) __pyx_t_33 = 1;
12390  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_33 = 1;
12391  if (unlikely(__pyx_t_33 != -1)) {
12392  __Pyx_RaiseBufferIndexError(__pyx_t_33);
12393  __PYX_ERR(0, 563, __pyx_L1_error)
12394  }
12395  __pyx_t_42 = __pyx_v_I;
12396  __pyx_t_33 = -1;
12397  if (__pyx_t_42 < 0) {
12398  __pyx_t_42 += __pyx_pybuffernd_f_up.diminfo[0].shape;
12399  if (unlikely(__pyx_t_42 < 0)) __pyx_t_33 = 0;
12400  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_f_up.diminfo[0].shape)) __pyx_t_33 = 0;
12401  if (unlikely(__pyx_t_33 != -1)) {
12402  __Pyx_RaiseBufferIndexError(__pyx_t_33);
12403  __PYX_ERR(0, 563, __pyx_L1_error)
12404  }
12405  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_f_up.diminfo[0].strides) = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_q_flin.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_q_flin.diminfo[1].strides, __pyx_t_39, __pyx_pybuffernd_q_flin.diminfo[2].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_q_kr_up.diminfo[1].strides)));
12406  }
12407 
12408  /* "subsurfaceTransportFunctions.pyx":566
12409  * #
12410  * #accumulate advection and stiffness contributions
12411  * for I in range(nSpace): # <<<<<<<<<<<<<<
12412  * elementResidual[eN,i] -= weight*f_up[I]*q_grad_w[eN,ebN,i,I]
12413  * for ii in range(rowptr[I],rowptr[I+1]):
12414  */
12415  __pyx_t_28 = __pyx_v_nSpace;
12416  for (__pyx_t_29 = 0; __pyx_t_29 < __pyx_t_28; __pyx_t_29+=1) {
12417  __pyx_v_I = __pyx_t_29;
12418 
12419  /* "subsurfaceTransportFunctions.pyx":567
12420  * #accumulate advection and stiffness contributions
12421  * for I in range(nSpace):
12422  * elementResidual[eN,i] -= weight*f_up[I]*q_grad_w[eN,ebN,i,I] # <<<<<<<<<<<<<<
12423  * for ii in range(rowptr[I],rowptr[I+1]):
12424  * elementResidual[eN,i] += weight*a_up[ii]*q_grad_u[eN,ebN,colind[ii]]*q_grad_w[eN,ebN,i,I]
12425  */
12426  __pyx_t_43 = __pyx_v_I;
12427  __pyx_t_33 = -1;
12428  if (__pyx_t_43 < 0) {
12429  __pyx_t_43 += __pyx_pybuffernd_f_up.diminfo[0].shape;
12430  if (unlikely(__pyx_t_43 < 0)) __pyx_t_33 = 0;
12431  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_f_up.diminfo[0].shape)) __pyx_t_33 = 0;
12432  if (unlikely(__pyx_t_33 != -1)) {
12433  __Pyx_RaiseBufferIndexError(__pyx_t_33);
12434  __PYX_ERR(0, 567, __pyx_L1_error)
12435  }
12436  __pyx_t_44 = __pyx_v_eN;
12437  __pyx_t_45 = __pyx_v_ebN;
12438  __pyx_t_46 = __pyx_v_i;
12439  __pyx_t_47 = __pyx_v_I;
12440  __pyx_t_33 = -1;
12441  if (__pyx_t_44 < 0) {
12442  __pyx_t_44 += __pyx_pybuffernd_q_grad_w.diminfo[0].shape;
12443  if (unlikely(__pyx_t_44 < 0)) __pyx_t_33 = 0;
12444  } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_q_grad_w.diminfo[0].shape)) __pyx_t_33 = 0;
12445  if (__pyx_t_45 < 0) {
12446  __pyx_t_45 += __pyx_pybuffernd_q_grad_w.diminfo[1].shape;
12447  if (unlikely(__pyx_t_45 < 0)) __pyx_t_33 = 1;
12448  } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_q_grad_w.diminfo[1].shape)) __pyx_t_33 = 1;
12449  if (__pyx_t_46 < 0) {
12450  __pyx_t_46 += __pyx_pybuffernd_q_grad_w.diminfo[2].shape;
12451  if (unlikely(__pyx_t_46 < 0)) __pyx_t_33 = 2;
12452  } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_q_grad_w.diminfo[2].shape)) __pyx_t_33 = 2;
12453  if (__pyx_t_47 < 0) {
12454  __pyx_t_47 += __pyx_pybuffernd_q_grad_w.diminfo[3].shape;
12455  if (unlikely(__pyx_t_47 < 0)) __pyx_t_33 = 3;
12456  } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_q_grad_w.diminfo[3].shape)) __pyx_t_33 = 3;
12457  if (unlikely(__pyx_t_33 != -1)) {
12458  __Pyx_RaiseBufferIndexError(__pyx_t_33);
12459  __PYX_ERR(0, 567, __pyx_L1_error)
12460  }
12461  __pyx_t_48 = __pyx_v_eN;
12462  __pyx_t_49 = __pyx_v_i;
12463  __pyx_t_33 = -1;
12464  if (__pyx_t_48 < 0) {
12465  __pyx_t_48 += __pyx_pybuffernd_elementResidual.diminfo[0].shape;
12466  if (unlikely(__pyx_t_48 < 0)) __pyx_t_33 = 0;
12467  } else if (unlikely(__pyx_t_48 >= __pyx_pybuffernd_elementResidual.diminfo[0].shape)) __pyx_t_33 = 0;
12468  if (__pyx_t_49 < 0) {
12469  __pyx_t_49 += __pyx_pybuffernd_elementResidual.diminfo[1].shape;
12470  if (unlikely(__pyx_t_49 < 0)) __pyx_t_33 = 1;
12471  } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_elementResidual.diminfo[1].shape)) __pyx_t_33 = 1;
12472  if (unlikely(__pyx_t_33 != -1)) {
12473  __Pyx_RaiseBufferIndexError(__pyx_t_33);
12474  __PYX_ERR(0, 567, __pyx_L1_error)
12475  }
12476  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_elementResidual.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_elementResidual.diminfo[1].strides) -= ((__pyx_v_weight * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_f_up.diminfo[0].strides))) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_q_grad_w.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_q_grad_w.diminfo[1].strides, __pyx_t_46, __pyx_pybuffernd_q_grad_w.diminfo[2].strides, __pyx_t_47, __pyx_pybuffernd_q_grad_w.diminfo[3].strides)));
12477 
12478  /* "subsurfaceTransportFunctions.pyx":568
12479  * for I in range(nSpace):
12480  * elementResidual[eN,i] -= weight*f_up[I]*q_grad_w[eN,ebN,i,I]
12481  * for ii in range(rowptr[I],rowptr[I+1]): # <<<<<<<<<<<<<<
12482  * elementResidual[eN,i] += weight*a_up[ii]*q_grad_u[eN,ebN,colind[ii]]*q_grad_w[eN,ebN,i,I]
12483  * #I
12484  */
12485  __pyx_t_50 = (__pyx_v_I + 1);
12486  __pyx_t_33 = -1;
12487  if (__pyx_t_50 < 0) {
12488  __pyx_t_50 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
12489  if (unlikely(__pyx_t_50 < 0)) __pyx_t_33 = 0;
12490  } else if (unlikely(__pyx_t_50 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_33 = 0;
12491  if (unlikely(__pyx_t_33 != -1)) {
12492  __Pyx_RaiseBufferIndexError(__pyx_t_33);
12493  __PYX_ERR(0, 568, __pyx_L1_error)
12494  }
12495  __pyx_t_51 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_rowptr.diminfo[0].strides));
12496  __pyx_t_52 = __pyx_v_I;
12497  __pyx_t_33 = -1;
12498  if (__pyx_t_52 < 0) {
12499  __pyx_t_52 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
12500  if (unlikely(__pyx_t_52 < 0)) __pyx_t_33 = 0;
12501  } else if (unlikely(__pyx_t_52 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_33 = 0;
12502  if (unlikely(__pyx_t_33 != -1)) {
12503  __Pyx_RaiseBufferIndexError(__pyx_t_33);
12504  __PYX_ERR(0, 568, __pyx_L1_error)
12505  }
12506  for (__pyx_t_33 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_rowptr.diminfo[0].strides)); __pyx_t_33 < __pyx_t_51; __pyx_t_33+=1) {
12507  __pyx_v_ii = __pyx_t_33;
12508 
12509  /* "subsurfaceTransportFunctions.pyx":569
12510  * elementResidual[eN,i] -= weight*f_up[I]*q_grad_w[eN,ebN,i,I]
12511  * for ii in range(rowptr[I],rowptr[I+1]):
12512  * elementResidual[eN,i] += weight*a_up[ii]*q_grad_u[eN,ebN,colind[ii]]*q_grad_w[eN,ebN,i,I] # <<<<<<<<<<<<<<
12513  * #I
12514  * #j
12515  */
12516  __pyx_t_53 = __pyx_v_ii;
12517  __pyx_t_54 = -1;
12518  if (__pyx_t_53 < 0) {
12519  __pyx_t_53 += __pyx_pybuffernd_a_up.diminfo[0].shape;
12520  if (unlikely(__pyx_t_53 < 0)) __pyx_t_54 = 0;
12521  } else if (unlikely(__pyx_t_53 >= __pyx_pybuffernd_a_up.diminfo[0].shape)) __pyx_t_54 = 0;
12522  if (unlikely(__pyx_t_54 != -1)) {
12523  __Pyx_RaiseBufferIndexError(__pyx_t_54);
12524  __PYX_ERR(0, 569, __pyx_L1_error)
12525  }
12526  __pyx_t_55 = __pyx_v_ii;
12527  __pyx_t_54 = -1;
12528  if (__pyx_t_55 < 0) {
12529  __pyx_t_55 += __pyx_pybuffernd_colind.diminfo[0].shape;
12530  if (unlikely(__pyx_t_55 < 0)) __pyx_t_54 = 0;
12531  } else if (unlikely(__pyx_t_55 >= __pyx_pybuffernd_colind.diminfo[0].shape)) __pyx_t_54 = 0;
12532  if (unlikely(__pyx_t_54 != -1)) {
12533  __Pyx_RaiseBufferIndexError(__pyx_t_54);
12534  __PYX_ERR(0, 569, __pyx_L1_error)
12535  }
12536  __pyx_t_56 = __pyx_v_eN;
12537  __pyx_t_57 = __pyx_v_ebN;
12538  __pyx_t_58 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_colind.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_colind.diminfo[0].strides));
12539  __pyx_t_54 = -1;
12540  if (__pyx_t_56 < 0) {
12541  __pyx_t_56 += __pyx_pybuffernd_q_grad_u.diminfo[0].shape;
12542  if (unlikely(__pyx_t_56 < 0)) __pyx_t_54 = 0;
12543  } else if (unlikely(__pyx_t_56 >= __pyx_pybuffernd_q_grad_u.diminfo[0].shape)) __pyx_t_54 = 0;
12544  if (__pyx_t_57 < 0) {
12545  __pyx_t_57 += __pyx_pybuffernd_q_grad_u.diminfo[1].shape;
12546  if (unlikely(__pyx_t_57 < 0)) __pyx_t_54 = 1;
12547  } else if (unlikely(__pyx_t_57 >= __pyx_pybuffernd_q_grad_u.diminfo[1].shape)) __pyx_t_54 = 1;
12548  if (__pyx_t_58 < 0) {
12549  __pyx_t_58 += __pyx_pybuffernd_q_grad_u.diminfo[2].shape;
12550  if (unlikely(__pyx_t_58 < 0)) __pyx_t_54 = 2;
12551  } else if (unlikely(__pyx_t_58 >= __pyx_pybuffernd_q_grad_u.diminfo[2].shape)) __pyx_t_54 = 2;
12552  if (unlikely(__pyx_t_54 != -1)) {
12553  __Pyx_RaiseBufferIndexError(__pyx_t_54);
12554  __PYX_ERR(0, 569, __pyx_L1_error)
12555  }
12556  __pyx_t_59 = __pyx_v_eN;
12557  __pyx_t_60 = __pyx_v_ebN;
12558  __pyx_t_61 = __pyx_v_i;
12559  __pyx_t_62 = __pyx_v_I;
12560  __pyx_t_54 = -1;
12561  if (__pyx_t_59 < 0) {
12562  __pyx_t_59 += __pyx_pybuffernd_q_grad_w.diminfo[0].shape;
12563  if (unlikely(__pyx_t_59 < 0)) __pyx_t_54 = 0;
12564  } else if (unlikely(__pyx_t_59 >= __pyx_pybuffernd_q_grad_w.diminfo[0].shape)) __pyx_t_54 = 0;
12565  if (__pyx_t_60 < 0) {
12566  __pyx_t_60 += __pyx_pybuffernd_q_grad_w.diminfo[1].shape;
12567  if (unlikely(__pyx_t_60 < 0)) __pyx_t_54 = 1;
12568  } else if (unlikely(__pyx_t_60 >= __pyx_pybuffernd_q_grad_w.diminfo[1].shape)) __pyx_t_54 = 1;
12569  if (__pyx_t_61 < 0) {
12570  __pyx_t_61 += __pyx_pybuffernd_q_grad_w.diminfo[2].shape;
12571  if (unlikely(__pyx_t_61 < 0)) __pyx_t_54 = 2;
12572  } else if (unlikely(__pyx_t_61 >= __pyx_pybuffernd_q_grad_w.diminfo[2].shape)) __pyx_t_54 = 2;
12573  if (__pyx_t_62 < 0) {
12574  __pyx_t_62 += __pyx_pybuffernd_q_grad_w.diminfo[3].shape;
12575  if (unlikely(__pyx_t_62 < 0)) __pyx_t_54 = 3;
12576  } else if (unlikely(__pyx_t_62 >= __pyx_pybuffernd_q_grad_w.diminfo[3].shape)) __pyx_t_54 = 3;
12577  if (unlikely(__pyx_t_54 != -1)) {
12578  __Pyx_RaiseBufferIndexError(__pyx_t_54);
12579  __PYX_ERR(0, 569, __pyx_L1_error)
12580  }
12581  __pyx_t_63 = __pyx_v_eN;
12582  __pyx_t_64 = __pyx_v_i;
12583  __pyx_t_54 = -1;
12584  if (__pyx_t_63 < 0) {
12585  __pyx_t_63 += __pyx_pybuffernd_elementResidual.diminfo[0].shape;
12586  if (unlikely(__pyx_t_63 < 0)) __pyx_t_54 = 0;
12587  } else if (unlikely(__pyx_t_63 >= __pyx_pybuffernd_elementResidual.diminfo[0].shape)) __pyx_t_54 = 0;
12588  if (__pyx_t_64 < 0) {
12589  __pyx_t_64 += __pyx_pybuffernd_elementResidual.diminfo[1].shape;
12590  if (unlikely(__pyx_t_64 < 0)) __pyx_t_54 = 1;
12591  } else if (unlikely(__pyx_t_64 >= __pyx_pybuffernd_elementResidual.diminfo[1].shape)) __pyx_t_54 = 1;
12592  if (unlikely(__pyx_t_54 != -1)) {
12593  __Pyx_RaiseBufferIndexError(__pyx_t_54);
12594  __PYX_ERR(0, 569, __pyx_L1_error)
12595  }
12596  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.buf, __pyx_t_63, __pyx_pybuffernd_elementResidual.diminfo[0].strides, __pyx_t_64, __pyx_pybuffernd_elementResidual.diminfo[1].strides) += (((__pyx_v_weight * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf, __pyx_t_53, __pyx_pybuffernd_a_up.diminfo[0].strides))) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_q_grad_u.diminfo[0].strides, __pyx_t_57, __pyx_pybuffernd_q_grad_u.diminfo[1].strides, __pyx_t_58, __pyx_pybuffernd_q_grad_u.diminfo[2].strides))) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.buf, __pyx_t_59, __pyx_pybuffernd_q_grad_w.diminfo[0].strides, __pyx_t_60, __pyx_pybuffernd_q_grad_w.diminfo[1].strides, __pyx_t_61, __pyx_pybuffernd_q_grad_w.diminfo[2].strides, __pyx_t_62, __pyx_pybuffernd_q_grad_w.diminfo[3].strides)));
12597  }
12598  }
12599  }
12600  }
12601  }
12602 
12603  /* "subsurfaceTransportFunctions.pyx":486
12604  * #eN for upwind
12605  *
12606  * def RE_NCP1_getElementResidual(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
12607  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
12608  * numpy.ndarray[ITYPE_t,ndim=1] colind,
12609  */
12610 
12611  /* function exit code */
12612  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12613  goto __pyx_L0;
12614  __pyx_L1_error:;
12615  __Pyx_XDECREF(__pyx_t_1);
12616  __Pyx_XDECREF(__pyx_t_2);
12617  __Pyx_XDECREF(__pyx_t_4);
12618  __Pyx_XDECREF(__pyx_t_5);
12619  __Pyx_XDECREF(__pyx_t_9);
12620  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
12621  __Pyx_PyThreadState_declare
12622  __Pyx_PyThreadState_assign
12623  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
12624  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer);
12625  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
12626  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
12627  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
12628  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementResidual.rcbuffer->pybuffer);
12629  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer);
12630  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
12631  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
12632  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer);
12633  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
12634  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer);
12635  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer);
12636  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
12637  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
12638  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer);
12639  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer);
12640  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
12641  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
12642  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
12643  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
12644  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_getElementResidual", __pyx_clineno, __pyx_lineno, __pyx_filename);
12645  __pyx_r = NULL;
12646  goto __pyx_L2;
12647  __pyx_L0:;
12648  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer);
12649  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
12650  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
12651  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
12652  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementResidual.rcbuffer->pybuffer);
12653  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer);
12654  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
12655  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
12656  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer);
12657  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
12658  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer);
12659  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer);
12660  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
12661  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
12662  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer);
12663  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer);
12664  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
12665  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
12666  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
12667  __pyx_L2:;
12668  __Pyx_XDECREF(__pyx_v_q);
12669  __Pyx_XDECREF((PyObject *)__pyx_v_a_up);
12670  __Pyx_XDECREF((PyObject *)__pyx_v_f_up);
12671  __Pyx_XGIVEREF(__pyx_r);
12672  __Pyx_RefNannyFinishContext();
12673  return __pyx_r;
12674 }
12675 
12676 /* "subsurfaceTransportFunctions.pyx":574
12677  * #i
12678  * #eN
12679  * def RE_NCP1_getElementJacobian(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
12680  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
12681  * numpy.ndarray[ITYPE_t,ndim=1] colind,
12682  */
12683 
12684 /* Python wrapper */
12685 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
12686 static char __pyx_doc_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian[] = "\n residual routine for NCP1 approximation for conservative head formulation of Richards equation \n\n Approximation:\n uses nodal quadrature where the nodes are face barycenters\n uses harmonic average for intrinsic permeability/ hydraulic conductivity\n upwinds relative permeability based on element averages\n applies dirichlet boundary conditions strongly but keeps dofs in system\n\n TODO:\n everything\n \n ";
12687 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian = {"RE_NCP1_getElementJacobian", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian};
12688 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
12689  CYTHON_UNUSED PyArrayObject *__pyx_v_gravity = 0;
12690  PyArrayObject *__pyx_v_rowptr = 0;
12691  PyArrayObject *__pyx_v_colind = 0;
12692  int __pyx_v_nSpace;
12693  int __pyx_v_nElements_global;
12694  int __pyx_v_nElementBoundaries_element;
12695  CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray = 0;
12696  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray = 0;
12697  int __pyx_v_nDOF_test_element;
12698  int __pyx_v_nDOF_trial_element;
12699  PyArrayObject *__pyx_v_q_u = 0;
12700  CYTHON_UNUSED PyArrayObject *__pyx_v_q_grad_u = 0;
12701  PyArrayObject *__pyx_v_q_grad_w = 0;
12702  PyArrayObject *__pyx_v_q_grad_v = 0;
12703  PyArrayObject *__pyx_v_q_detJ = 0;
12704  PyArrayObject *__pyx_v_q_m = 0;
12705  CYTHON_UNUSED PyArrayObject *__pyx_v_q_dm = 0;
12706  PyArrayObject *__pyx_v_q_mt = 0;
12707  PyArrayObject *__pyx_v_q_dmt = 0;
12708  PyArrayObject *__pyx_v_q_r = 0;
12709  PyArrayObject *__pyx_v_q_kr = 0;
12710  CYTHON_UNUSED PyArrayObject *__pyx_v_q_dkr = 0;
12711  PyArrayObject *__pyx_v_q_kr_up = 0;
12712  PyArrayObject *__pyx_v_q_flin = 0;
12713  PyArrayObject *__pyx_v_q_alin = 0;
12714  PyArrayObject *__pyx_v_elementJacobian = 0;
12715  PyObject *__pyx_r = 0;
12716  __Pyx_RefNannyDeclarations
12717  __Pyx_RefNannySetupContext("RE_NCP1_getElementJacobian (wrapper)", 0);
12718  {
12719  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gravity,&__pyx_n_s_rowptr,&__pyx_n_s_colind,&__pyx_n_s_nSpace,&__pyx_n_s_nElements_global,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_nDOF_test_element,&__pyx_n_s_nDOF_trial_element,&__pyx_n_s_q_u,&__pyx_n_s_q_grad_u,&__pyx_n_s_q_grad_w,&__pyx_n_s_q_grad_v,&__pyx_n_s_q_detJ,&__pyx_n_s_q_m,&__pyx_n_s_q_dm,&__pyx_n_s_q_mt,&__pyx_n_s_q_dmt,&__pyx_n_s_q_r,&__pyx_n_s_q_kr,&__pyx_n_s_q_dkr,&__pyx_n_s_q_kr_up,&__pyx_n_s_q_flin,&__pyx_n_s_q_alin,&__pyx_n_s_elementJacobian,0};
12720  PyObject* values[26] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
12721  if (unlikely(__pyx_kwds)) {
12722  Py_ssize_t kw_args;
12723  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
12724  switch (pos_args) {
12725  case 26: values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
12726  case 25: values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
12727  case 24: values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
12728  case 23: values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
12729  case 22: values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
12730  case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
12731  case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
12732  case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
12733  case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
12734  case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
12735  case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
12736  case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
12737  case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
12738  case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
12739  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
12740  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
12741  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
12742  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
12743  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
12744  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
12745  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
12746  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
12747  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
12748  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
12749  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
12750  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
12751  case 0: break;
12752  default: goto __pyx_L5_argtuple_error;
12753  }
12754  kw_args = PyDict_Size(__pyx_kwds);
12755  switch (pos_args) {
12756  case 0:
12757  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--;
12758  else goto __pyx_L5_argtuple_error;
12759  case 1:
12760  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rowptr)) != 0)) kw_args--;
12761  else {
12762  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 1); __PYX_ERR(0, 574, __pyx_L3_error)
12763  }
12764  case 2:
12765  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_colind)) != 0)) kw_args--;
12766  else {
12767  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 2); __PYX_ERR(0, 574, __pyx_L3_error)
12768  }
12769  case 3:
12770  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nSpace)) != 0)) kw_args--;
12771  else {
12772  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 3); __PYX_ERR(0, 574, __pyx_L3_error)
12773  }
12774  case 4:
12775  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
12776  else {
12777  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 4); __PYX_ERR(0, 574, __pyx_L3_error)
12778  }
12779  case 5:
12780  if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
12781  else {
12782  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 5); __PYX_ERR(0, 574, __pyx_L3_error)
12783  }
12784  case 6:
12785  if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
12786  else {
12787  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 6); __PYX_ERR(0, 574, __pyx_L3_error)
12788  }
12789  case 7:
12790  if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
12791  else {
12792  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 7); __PYX_ERR(0, 574, __pyx_L3_error)
12793  }
12794  case 8:
12795  if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nDOF_test_element)) != 0)) kw_args--;
12796  else {
12797  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 8); __PYX_ERR(0, 574, __pyx_L3_error)
12798  }
12799  case 9:
12800  if (likely((values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nDOF_trial_element)) != 0)) kw_args--;
12801  else {
12802  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 9); __PYX_ERR(0, 574, __pyx_L3_error)
12803  }
12804  case 10:
12805  if (likely((values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_u)) != 0)) kw_args--;
12806  else {
12807  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 10); __PYX_ERR(0, 574, __pyx_L3_error)
12808  }
12809  case 11:
12810  if (likely((values[11] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_grad_u)) != 0)) kw_args--;
12811  else {
12812  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 11); __PYX_ERR(0, 574, __pyx_L3_error)
12813  }
12814  case 12:
12815  if (likely((values[12] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_grad_w)) != 0)) kw_args--;
12816  else {
12817  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 12); __PYX_ERR(0, 574, __pyx_L3_error)
12818  }
12819  case 13:
12820  if (likely((values[13] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_grad_v)) != 0)) kw_args--;
12821  else {
12822  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 13); __PYX_ERR(0, 574, __pyx_L3_error)
12823  }
12824  case 14:
12825  if (likely((values[14] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_detJ)) != 0)) kw_args--;
12826  else {
12827  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 14); __PYX_ERR(0, 574, __pyx_L3_error)
12828  }
12829  case 15:
12830  if (likely((values[15] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_m)) != 0)) kw_args--;
12831  else {
12832  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 15); __PYX_ERR(0, 574, __pyx_L3_error)
12833  }
12834  case 16:
12835  if (likely((values[16] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_dm)) != 0)) kw_args--;
12836  else {
12837  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 16); __PYX_ERR(0, 574, __pyx_L3_error)
12838  }
12839  case 17:
12840  if (likely((values[17] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_mt)) != 0)) kw_args--;
12841  else {
12842  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 17); __PYX_ERR(0, 574, __pyx_L3_error)
12843  }
12844  case 18:
12845  if (likely((values[18] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_dmt)) != 0)) kw_args--;
12846  else {
12847  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 18); __PYX_ERR(0, 574, __pyx_L3_error)
12848  }
12849  case 19:
12850  if (likely((values[19] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_r)) != 0)) kw_args--;
12851  else {
12852  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 19); __PYX_ERR(0, 574, __pyx_L3_error)
12853  }
12854  case 20:
12855  if (likely((values[20] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_kr)) != 0)) kw_args--;
12856  else {
12857  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 20); __PYX_ERR(0, 574, __pyx_L3_error)
12858  }
12859  case 21:
12860  if (likely((values[21] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_dkr)) != 0)) kw_args--;
12861  else {
12862  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 21); __PYX_ERR(0, 574, __pyx_L3_error)
12863  }
12864  case 22:
12865  if (likely((values[22] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_kr_up)) != 0)) kw_args--;
12866  else {
12867  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 22); __PYX_ERR(0, 574, __pyx_L3_error)
12868  }
12869  case 23:
12870  if (likely((values[23] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_flin)) != 0)) kw_args--;
12871  else {
12872  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 23); __PYX_ERR(0, 574, __pyx_L3_error)
12873  }
12874  case 24:
12875  if (likely((values[24] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q_alin)) != 0)) kw_args--;
12876  else {
12877  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 24); __PYX_ERR(0, 574, __pyx_L3_error)
12878  }
12879  case 25:
12880  if (likely((values[25] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_elementJacobian)) != 0)) kw_args--;
12881  else {
12882  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 25); __PYX_ERR(0, 574, __pyx_L3_error)
12883  }
12884  }
12885  if (unlikely(kw_args > 0)) {
12886  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RE_NCP1_getElementJacobian") < 0)) __PYX_ERR(0, 574, __pyx_L3_error)
12887  }
12888  } else if (PyTuple_GET_SIZE(__pyx_args) != 26) {
12889  goto __pyx_L5_argtuple_error;
12890  } else {
12891  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
12892  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
12893  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
12894  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
12895  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
12896  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
12897  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
12898  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
12899  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
12900  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
12901  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
12902  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
12903  values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
12904  values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
12905  values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
12906  values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
12907  values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
12908  values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
12909  values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
12910  values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
12911  values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
12912  values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
12913  values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
12914  values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
12915  values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
12916  values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
12917  }
12918  __pyx_v_gravity = ((PyArrayObject *)values[0]);
12919  __pyx_v_rowptr = ((PyArrayObject *)values[1]);
12920  __pyx_v_colind = ((PyArrayObject *)values[2]);
12921  __pyx_v_nSpace = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nSpace == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 578, __pyx_L3_error)
12922  __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nElements_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 579, __pyx_L3_error)
12923  __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nElementBoundaries_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 580, __pyx_L3_error)
12924  __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[6]);
12925  __pyx_v_elementBarycentersArray = ((PyArrayObject *)values[7]);
12926  __pyx_v_nDOF_test_element = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_nDOF_test_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 584, __pyx_L3_error)
12927  __pyx_v_nDOF_trial_element = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_nDOF_trial_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 585, __pyx_L3_error)
12928  __pyx_v_q_u = ((PyArrayObject *)values[10]);
12929  __pyx_v_q_grad_u = ((PyArrayObject *)values[11]);
12930  __pyx_v_q_grad_w = ((PyArrayObject *)values[12]);
12931  __pyx_v_q_grad_v = ((PyArrayObject *)values[13]);
12932  __pyx_v_q_detJ = ((PyArrayObject *)values[14]);
12933  __pyx_v_q_m = ((PyArrayObject *)values[15]);
12934  __pyx_v_q_dm = ((PyArrayObject *)values[16]);
12935  __pyx_v_q_mt = ((PyArrayObject *)values[17]);
12936  __pyx_v_q_dmt = ((PyArrayObject *)values[18]);
12937  __pyx_v_q_r = ((PyArrayObject *)values[19]);
12938  __pyx_v_q_kr = ((PyArrayObject *)values[20]);
12939  __pyx_v_q_dkr = ((PyArrayObject *)values[21]);
12940  __pyx_v_q_kr_up = ((PyArrayObject *)values[22]);
12941  __pyx_v_q_flin = ((PyArrayObject *)values[23]);
12942  __pyx_v_q_alin = ((PyArrayObject *)values[24]);
12943  __pyx_v_elementJacobian = ((PyArrayObject *)values[25]);
12944  }
12945  goto __pyx_L4_argument_unpacking_done;
12946  __pyx_L5_argtuple_error:;
12947  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 574, __pyx_L3_error)
12948  __pyx_L3_error:;
12949  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_getElementJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
12950  __Pyx_RefNannyFinishContext();
12951  return NULL;
12952  __pyx_L4_argument_unpacking_done:;
12953  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gravity), __pyx_ptype_5numpy_ndarray, 1, "gravity", 0))) __PYX_ERR(0, 574, __pyx_L1_error)
12954  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rowptr), __pyx_ptype_5numpy_ndarray, 1, "rowptr", 0))) __PYX_ERR(0, 575, __pyx_L1_error)
12955  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_colind), __pyx_ptype_5numpy_ndarray, 1, "colind", 0))) __PYX_ERR(0, 576, __pyx_L1_error)
12956  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1, "elementNeighborsArray", 0))) __PYX_ERR(0, 581, __pyx_L1_error)
12957  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_ptype_5numpy_ndarray, 1, "elementBarycentersArray", 0))) __PYX_ERR(0, 582, __pyx_L1_error)
12958  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_u), __pyx_ptype_5numpy_ndarray, 1, "q_u", 0))) __PYX_ERR(0, 586, __pyx_L1_error)
12959  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_u), __pyx_ptype_5numpy_ndarray, 1, "q_grad_u", 0))) __PYX_ERR(0, 587, __pyx_L1_error)
12960  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_w), __pyx_ptype_5numpy_ndarray, 1, "q_grad_w", 0))) __PYX_ERR(0, 588, __pyx_L1_error)
12961  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_v), __pyx_ptype_5numpy_ndarray, 1, "q_grad_v", 0))) __PYX_ERR(0, 589, __pyx_L1_error)
12962  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_detJ), __pyx_ptype_5numpy_ndarray, 1, "q_detJ", 0))) __PYX_ERR(0, 591, __pyx_L1_error)
12963  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_m), __pyx_ptype_5numpy_ndarray, 1, "q_m", 0))) __PYX_ERR(0, 592, __pyx_L1_error)
12964  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dm), __pyx_ptype_5numpy_ndarray, 1, "q_dm", 0))) __PYX_ERR(0, 593, __pyx_L1_error)
12965  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_mt), __pyx_ptype_5numpy_ndarray, 1, "q_mt", 0))) __PYX_ERR(0, 594, __pyx_L1_error)
12966  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dmt), __pyx_ptype_5numpy_ndarray, 1, "q_dmt", 0))) __PYX_ERR(0, 595, __pyx_L1_error)
12967  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_r), __pyx_ptype_5numpy_ndarray, 1, "q_r", 0))) __PYX_ERR(0, 596, __pyx_L1_error)
12968  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr), __pyx_ptype_5numpy_ndarray, 1, "q_kr", 0))) __PYX_ERR(0, 597, __pyx_L1_error)
12969  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dkr), __pyx_ptype_5numpy_ndarray, 1, "q_dkr", 0))) __PYX_ERR(0, 598, __pyx_L1_error)
12970  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr_up), __pyx_ptype_5numpy_ndarray, 1, "q_kr_up", 0))) __PYX_ERR(0, 599, __pyx_L1_error)
12971  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_flin), __pyx_ptype_5numpy_ndarray, 1, "q_flin", 0))) __PYX_ERR(0, 602, __pyx_L1_error)
12972  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_alin), __pyx_ptype_5numpy_ndarray, 1, "q_alin", 0))) __PYX_ERR(0, 603, __pyx_L1_error)
12973  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementJacobian), __pyx_ptype_5numpy_ndarray, 1, "elementJacobian", 0))) __PYX_ERR(0, 605, __pyx_L1_error)
12974  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian(__pyx_self, __pyx_v_gravity, __pyx_v_rowptr, __pyx_v_colind, __pyx_v_nSpace, __pyx_v_nElements_global, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_elementBarycentersArray, __pyx_v_nDOF_test_element, __pyx_v_nDOF_trial_element, __pyx_v_q_u, __pyx_v_q_grad_u, __pyx_v_q_grad_w, __pyx_v_q_grad_v, __pyx_v_q_detJ, __pyx_v_q_m, __pyx_v_q_dm, __pyx_v_q_mt, __pyx_v_q_dmt, __pyx_v_q_r, __pyx_v_q_kr, __pyx_v_q_dkr, __pyx_v_q_kr_up, __pyx_v_q_flin, __pyx_v_q_alin, __pyx_v_elementJacobian);
12975 
12976  /* function exit code */
12977  goto __pyx_L0;
12978  __pyx_L1_error:;
12979  __pyx_r = NULL;
12980  __pyx_L0:;
12981  __Pyx_RefNannyFinishContext();
12982  return __pyx_r;
12983 }
12984 
12985 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray, int __pyx_v_nDOF_test_element, int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_q_u, CYTHON_UNUSED PyArrayObject *__pyx_v_q_grad_u, PyArrayObject *__pyx_v_q_grad_w, PyArrayObject *__pyx_v_q_grad_v, PyArrayObject *__pyx_v_q_detJ, PyArrayObject *__pyx_v_q_m, CYTHON_UNUSED PyArrayObject *__pyx_v_q_dm, PyArrayObject *__pyx_v_q_mt, PyArrayObject *__pyx_v_q_dmt, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, CYTHON_UNUSED PyArrayObject *__pyx_v_q_dkr, PyArrayObject *__pyx_v_q_kr_up, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin, PyArrayObject *__pyx_v_elementJacobian) {
12986  CYTHON_UNUSED int __pyx_v_upwindFlag;
12987  CYTHON_UNUSED int __pyx_v_picard;
12988  PyObject *__pyx_v_q = NULL;
12989  int __pyx_v_nnz;
12990  int __pyx_v_eN;
12991  int __pyx_v_ii;
12992  int __pyx_v_I;
12993  PyArrayObject *__pyx_v_a_up = 0;
12994  PyArrayObject *__pyx_v_f_up = 0;
12995  double __pyx_v_nAvgWeight;
12996  double __pyx_v_weight;
12997  double __pyx_v_volFactor;
12998  CYTHON_UNUSED int __pyx_v_thisElementIsUpwind;
12999  double __pyx_v_volume;
13000  int __pyx_v_i;
13001  int __pyx_v_ebN;
13002  int __pyx_v_j;
13003  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_up;
13004  __Pyx_Buffer __pyx_pybuffer_a_up;
13005  __Pyx_LocalBuf_ND __pyx_pybuffernd_colind;
13006  __Pyx_Buffer __pyx_pybuffer_colind;
13007  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBarycentersArray;
13008  __Pyx_Buffer __pyx_pybuffer_elementBarycentersArray;
13009  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementJacobian;
13010  __Pyx_Buffer __pyx_pybuffer_elementJacobian;
13011  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementNeighborsArray;
13012  __Pyx_Buffer __pyx_pybuffer_elementNeighborsArray;
13013  __Pyx_LocalBuf_ND __pyx_pybuffernd_f_up;
13014  __Pyx_Buffer __pyx_pybuffer_f_up;
13015  __Pyx_LocalBuf_ND __pyx_pybuffernd_gravity;
13016  __Pyx_Buffer __pyx_pybuffer_gravity;
13017  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_alin;
13018  __Pyx_Buffer __pyx_pybuffer_q_alin;
13019  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_detJ;
13020  __Pyx_Buffer __pyx_pybuffer_q_detJ;
13021  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dkr;
13022  __Pyx_Buffer __pyx_pybuffer_q_dkr;
13023  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dm;
13024  __Pyx_Buffer __pyx_pybuffer_q_dm;
13025  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dmt;
13026  __Pyx_Buffer __pyx_pybuffer_q_dmt;
13027  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_flin;
13028  __Pyx_Buffer __pyx_pybuffer_q_flin;
13029  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_u;
13030  __Pyx_Buffer __pyx_pybuffer_q_grad_u;
13031  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_v;
13032  __Pyx_Buffer __pyx_pybuffer_q_grad_v;
13033  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_w;
13034  __Pyx_Buffer __pyx_pybuffer_q_grad_w;
13035  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr;
13036  __Pyx_Buffer __pyx_pybuffer_q_kr;
13037  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr_up;
13038  __Pyx_Buffer __pyx_pybuffer_q_kr_up;
13039  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_m;
13040  __Pyx_Buffer __pyx_pybuffer_q_m;
13041  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_mt;
13042  __Pyx_Buffer __pyx_pybuffer_q_mt;
13043  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_r;
13044  __Pyx_Buffer __pyx_pybuffer_q_r;
13045  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_u;
13046  __Pyx_Buffer __pyx_pybuffer_q_u;
13047  __Pyx_LocalBuf_ND __pyx_pybuffernd_rowptr;
13048  __Pyx_Buffer __pyx_pybuffer_rowptr;
13049  PyObject *__pyx_r = NULL;
13050  __Pyx_RefNannyDeclarations
13051  PyObject *__pyx_t_1 = NULL;
13052  PyObject *__pyx_t_2 = NULL;
13053  Py_ssize_t __pyx_t_3;
13054  PyObject *__pyx_t_4 = NULL;
13055  PyObject *__pyx_t_5 = NULL;
13056  int __pyx_t_6;
13057  Py_ssize_t __pyx_t_7;
13058  int __pyx_t_8;
13059  PyObject *__pyx_t_9 = NULL;
13060  PyArrayObject *__pyx_t_10 = NULL;
13061  PyArrayObject *__pyx_t_11 = NULL;
13062  double __pyx_t_12;
13063  int __pyx_t_13;
13064  Py_ssize_t __pyx_t_14;
13065  Py_ssize_t __pyx_t_15;
13066  int __pyx_t_16;
13067  int __pyx_t_17;
13068  Py_ssize_t __pyx_t_18;
13069  Py_ssize_t __pyx_t_19;
13070  int __pyx_t_20;
13071  Py_ssize_t __pyx_t_21;
13072  Py_ssize_t __pyx_t_22;
13073  Py_ssize_t __pyx_t_23;
13074  int __pyx_t_24;
13075  int __pyx_t_25;
13076  int __pyx_t_26;
13077  Py_ssize_t __pyx_t_27;
13078  Py_ssize_t __pyx_t_28;
13079  Py_ssize_t __pyx_t_29;
13080  int __pyx_t_30;
13081  Py_ssize_t __pyx_t_31;
13082  Py_ssize_t __pyx_t_32;
13083  Py_ssize_t __pyx_t_33;
13084  Py_ssize_t __pyx_t_34;
13085  Py_ssize_t __pyx_t_35;
13086  Py_ssize_t __pyx_t_36;
13087  Py_ssize_t __pyx_t_37;
13088  Py_ssize_t __pyx_t_38;
13089  Py_ssize_t __pyx_t_39;
13090  int __pyx_t_40;
13091  Py_ssize_t __pyx_t_41;
13092  int __pyx_t_42;
13093  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_43;
13094  Py_ssize_t __pyx_t_44;
13095  Py_ssize_t __pyx_t_45;
13096  int __pyx_t_46;
13097  Py_ssize_t __pyx_t_47;
13098  Py_ssize_t __pyx_t_48;
13099  Py_ssize_t __pyx_t_49;
13100  Py_ssize_t __pyx_t_50;
13101  Py_ssize_t __pyx_t_51;
13102  Py_ssize_t __pyx_t_52;
13103  Py_ssize_t __pyx_t_53;
13104  Py_ssize_t __pyx_t_54;
13105  Py_ssize_t __pyx_t_55;
13106  Py_ssize_t __pyx_t_56;
13107  Py_ssize_t __pyx_t_57;
13108  Py_ssize_t __pyx_t_58;
13109  __Pyx_RefNannySetupContext("RE_NCP1_getElementJacobian", 0);
13110  __pyx_pybuffer_a_up.pybuffer.buf = NULL;
13111  __pyx_pybuffer_a_up.refcount = 0;
13112  __pyx_pybuffernd_a_up.data = NULL;
13113  __pyx_pybuffernd_a_up.rcbuffer = &__pyx_pybuffer_a_up;
13114  __pyx_pybuffer_f_up.pybuffer.buf = NULL;
13115  __pyx_pybuffer_f_up.refcount = 0;
13116  __pyx_pybuffernd_f_up.data = NULL;
13117  __pyx_pybuffernd_f_up.rcbuffer = &__pyx_pybuffer_f_up;
13118  __pyx_pybuffer_gravity.pybuffer.buf = NULL;
13119  __pyx_pybuffer_gravity.refcount = 0;
13120  __pyx_pybuffernd_gravity.data = NULL;
13121  __pyx_pybuffernd_gravity.rcbuffer = &__pyx_pybuffer_gravity;
13122  __pyx_pybuffer_rowptr.pybuffer.buf = NULL;
13123  __pyx_pybuffer_rowptr.refcount = 0;
13124  __pyx_pybuffernd_rowptr.data = NULL;
13125  __pyx_pybuffernd_rowptr.rcbuffer = &__pyx_pybuffer_rowptr;
13126  __pyx_pybuffer_colind.pybuffer.buf = NULL;
13127  __pyx_pybuffer_colind.refcount = 0;
13128  __pyx_pybuffernd_colind.data = NULL;
13129  __pyx_pybuffernd_colind.rcbuffer = &__pyx_pybuffer_colind;
13130  __pyx_pybuffer_elementNeighborsArray.pybuffer.buf = NULL;
13131  __pyx_pybuffer_elementNeighborsArray.refcount = 0;
13132  __pyx_pybuffernd_elementNeighborsArray.data = NULL;
13133  __pyx_pybuffernd_elementNeighborsArray.rcbuffer = &__pyx_pybuffer_elementNeighborsArray;
13134  __pyx_pybuffer_elementBarycentersArray.pybuffer.buf = NULL;
13135  __pyx_pybuffer_elementBarycentersArray.refcount = 0;
13136  __pyx_pybuffernd_elementBarycentersArray.data = NULL;
13137  __pyx_pybuffernd_elementBarycentersArray.rcbuffer = &__pyx_pybuffer_elementBarycentersArray;
13138  __pyx_pybuffer_q_u.pybuffer.buf = NULL;
13139  __pyx_pybuffer_q_u.refcount = 0;
13140  __pyx_pybuffernd_q_u.data = NULL;
13141  __pyx_pybuffernd_q_u.rcbuffer = &__pyx_pybuffer_q_u;
13142  __pyx_pybuffer_q_grad_u.pybuffer.buf = NULL;
13143  __pyx_pybuffer_q_grad_u.refcount = 0;
13144  __pyx_pybuffernd_q_grad_u.data = NULL;
13145  __pyx_pybuffernd_q_grad_u.rcbuffer = &__pyx_pybuffer_q_grad_u;
13146  __pyx_pybuffer_q_grad_w.pybuffer.buf = NULL;
13147  __pyx_pybuffer_q_grad_w.refcount = 0;
13148  __pyx_pybuffernd_q_grad_w.data = NULL;
13149  __pyx_pybuffernd_q_grad_w.rcbuffer = &__pyx_pybuffer_q_grad_w;
13150  __pyx_pybuffer_q_grad_v.pybuffer.buf = NULL;
13151  __pyx_pybuffer_q_grad_v.refcount = 0;
13152  __pyx_pybuffernd_q_grad_v.data = NULL;
13153  __pyx_pybuffernd_q_grad_v.rcbuffer = &__pyx_pybuffer_q_grad_v;
13154  __pyx_pybuffer_q_detJ.pybuffer.buf = NULL;
13155  __pyx_pybuffer_q_detJ.refcount = 0;
13156  __pyx_pybuffernd_q_detJ.data = NULL;
13157  __pyx_pybuffernd_q_detJ.rcbuffer = &__pyx_pybuffer_q_detJ;
13158  __pyx_pybuffer_q_m.pybuffer.buf = NULL;
13159  __pyx_pybuffer_q_m.refcount = 0;
13160  __pyx_pybuffernd_q_m.data = NULL;
13161  __pyx_pybuffernd_q_m.rcbuffer = &__pyx_pybuffer_q_m;
13162  __pyx_pybuffer_q_dm.pybuffer.buf = NULL;
13163  __pyx_pybuffer_q_dm.refcount = 0;
13164  __pyx_pybuffernd_q_dm.data = NULL;
13165  __pyx_pybuffernd_q_dm.rcbuffer = &__pyx_pybuffer_q_dm;
13166  __pyx_pybuffer_q_mt.pybuffer.buf = NULL;
13167  __pyx_pybuffer_q_mt.refcount = 0;
13168  __pyx_pybuffernd_q_mt.data = NULL;
13169  __pyx_pybuffernd_q_mt.rcbuffer = &__pyx_pybuffer_q_mt;
13170  __pyx_pybuffer_q_dmt.pybuffer.buf = NULL;
13171  __pyx_pybuffer_q_dmt.refcount = 0;
13172  __pyx_pybuffernd_q_dmt.data = NULL;
13173  __pyx_pybuffernd_q_dmt.rcbuffer = &__pyx_pybuffer_q_dmt;
13174  __pyx_pybuffer_q_r.pybuffer.buf = NULL;
13175  __pyx_pybuffer_q_r.refcount = 0;
13176  __pyx_pybuffernd_q_r.data = NULL;
13177  __pyx_pybuffernd_q_r.rcbuffer = &__pyx_pybuffer_q_r;
13178  __pyx_pybuffer_q_kr.pybuffer.buf = NULL;
13179  __pyx_pybuffer_q_kr.refcount = 0;
13180  __pyx_pybuffernd_q_kr.data = NULL;
13181  __pyx_pybuffernd_q_kr.rcbuffer = &__pyx_pybuffer_q_kr;
13182  __pyx_pybuffer_q_dkr.pybuffer.buf = NULL;
13183  __pyx_pybuffer_q_dkr.refcount = 0;
13184  __pyx_pybuffernd_q_dkr.data = NULL;
13185  __pyx_pybuffernd_q_dkr.rcbuffer = &__pyx_pybuffer_q_dkr;
13186  __pyx_pybuffer_q_kr_up.pybuffer.buf = NULL;
13187  __pyx_pybuffer_q_kr_up.refcount = 0;
13188  __pyx_pybuffernd_q_kr_up.data = NULL;
13189  __pyx_pybuffernd_q_kr_up.rcbuffer = &__pyx_pybuffer_q_kr_up;
13190  __pyx_pybuffer_q_flin.pybuffer.buf = NULL;
13191  __pyx_pybuffer_q_flin.refcount = 0;
13192  __pyx_pybuffernd_q_flin.data = NULL;
13193  __pyx_pybuffernd_q_flin.rcbuffer = &__pyx_pybuffer_q_flin;
13194  __pyx_pybuffer_q_alin.pybuffer.buf = NULL;
13195  __pyx_pybuffer_q_alin.refcount = 0;
13196  __pyx_pybuffernd_q_alin.data = NULL;
13197  __pyx_pybuffernd_q_alin.rcbuffer = &__pyx_pybuffer_q_alin;
13198  __pyx_pybuffer_elementJacobian.pybuffer.buf = NULL;
13199  __pyx_pybuffer_elementJacobian.refcount = 0;
13200  __pyx_pybuffernd_elementJacobian.data = NULL;
13201  __pyx_pybuffernd_elementJacobian.rcbuffer = &__pyx_pybuffer_elementJacobian;
13202  {
13203  __Pyx_BufFmt_StackElem __pyx_stack[1];
13204  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer, (PyObject*)__pyx_v_gravity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13205  }
13206  __pyx_pybuffernd_gravity.diminfo[0].strides = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gravity.diminfo[0].shape = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.shape[0];
13207  {
13208  __Pyx_BufFmt_StackElem __pyx_stack[1];
13209  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_rowptr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13210  }
13211  __pyx_pybuffernd_rowptr.diminfo[0].strides = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rowptr.diminfo[0].shape = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.shape[0];
13212  {
13213  __Pyx_BufFmt_StackElem __pyx_stack[1];
13214  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_colind.rcbuffer->pybuffer, (PyObject*)__pyx_v_colind, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13215  }
13216  __pyx_pybuffernd_colind.diminfo[0].strides = __pyx_pybuffernd_colind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_colind.diminfo[0].shape = __pyx_pybuffernd_colind.rcbuffer->pybuffer.shape[0];
13217  {
13218  __Pyx_BufFmt_StackElem __pyx_stack[1];
13219  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementNeighborsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13220  }
13221  __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[1];
13222  {
13223  __Pyx_BufFmt_StackElem __pyx_stack[1];
13224  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBarycentersArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13225  }
13226  __pyx_pybuffernd_elementBarycentersArray.diminfo[0].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[0].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[1];
13227  {
13228  __Pyx_BufFmt_StackElem __pyx_stack[1];
13229  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13230  }
13231  __pyx_pybuffernd_q_u.diminfo[0].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_u.diminfo[0].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_u.diminfo[1].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_u.diminfo[1].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[1];
13232  {
13233  __Pyx_BufFmt_StackElem __pyx_stack[1];
13234  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13235  }
13236  __pyx_pybuffernd_q_grad_u.diminfo[0].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_u.diminfo[0].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_u.diminfo[1].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_u.diminfo[1].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_u.diminfo[2].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_u.diminfo[2].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[2];
13237  {
13238  __Pyx_BufFmt_StackElem __pyx_stack[1];
13239  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_w, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13240  }
13241  __pyx_pybuffernd_q_grad_w.diminfo[0].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_w.diminfo[0].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_w.diminfo[1].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_w.diminfo[1].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_w.diminfo[2].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_w.diminfo[2].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_q_grad_w.diminfo[3].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_q_grad_w.diminfo[3].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[3];
13242  {
13243  __Pyx_BufFmt_StackElem __pyx_stack[1];
13244  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13245  }
13246  __pyx_pybuffernd_q_grad_v.diminfo[0].strides = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_v.diminfo[0].shape = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_v.diminfo[1].strides = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_v.diminfo[1].shape = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_v.diminfo[2].strides = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_v.diminfo[2].shape = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_q_grad_v.diminfo[3].strides = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_q_grad_v.diminfo[3].shape = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.shape[3];
13247  {
13248  __Pyx_BufFmt_StackElem __pyx_stack[1];
13249  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_detJ, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13250  }
13251  __pyx_pybuffernd_q_detJ.diminfo[0].strides = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_detJ.diminfo[0].shape = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_detJ.diminfo[1].strides = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_detJ.diminfo[1].shape = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.shape[1];
13252  {
13253  __Pyx_BufFmt_StackElem __pyx_stack[1];
13254  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_m, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13255  }
13256  __pyx_pybuffernd_q_m.diminfo[0].strides = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_m.diminfo[0].shape = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_m.diminfo[1].strides = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_m.diminfo[1].shape = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.shape[1];
13257  {
13258  __Pyx_BufFmt_StackElem __pyx_stack[1];
13259  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dm.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dm, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13260  }
13261  __pyx_pybuffernd_q_dm.diminfo[0].strides = __pyx_pybuffernd_q_dm.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dm.diminfo[0].shape = __pyx_pybuffernd_q_dm.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dm.diminfo[1].strides = __pyx_pybuffernd_q_dm.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dm.diminfo[1].shape = __pyx_pybuffernd_q_dm.rcbuffer->pybuffer.shape[1];
13262  {
13263  __Pyx_BufFmt_StackElem __pyx_stack[1];
13264  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_mt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13265  }
13266  __pyx_pybuffernd_q_mt.diminfo[0].strides = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_mt.diminfo[0].shape = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_mt.diminfo[1].strides = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_mt.diminfo[1].shape = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.shape[1];
13267  {
13268  __Pyx_BufFmt_StackElem __pyx_stack[1];
13269  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dmt.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dmt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13270  }
13271  __pyx_pybuffernd_q_dmt.diminfo[0].strides = __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dmt.diminfo[0].shape = __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dmt.diminfo[1].strides = __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dmt.diminfo[1].shape = __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.shape[1];
13272  {
13273  __Pyx_BufFmt_StackElem __pyx_stack[1];
13274  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_r, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13275  }
13276  __pyx_pybuffernd_q_r.diminfo[0].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_r.diminfo[0].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_r.diminfo[1].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_r.diminfo[1].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[1];
13277  {
13278  __Pyx_BufFmt_StackElem __pyx_stack[1];
13279  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13280  }
13281  __pyx_pybuffernd_q_kr.diminfo[0].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr.diminfo[0].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr.diminfo[1].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr.diminfo[1].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[1];
13282  {
13283  __Pyx_BufFmt_StackElem __pyx_stack[1];
13284  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dkr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13285  }
13286  __pyx_pybuffernd_q_dkr.diminfo[0].strides = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dkr.diminfo[0].shape = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dkr.diminfo[1].strides = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dkr.diminfo[1].shape = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.shape[1];
13287  {
13288  __Pyx_BufFmt_StackElem __pyx_stack[1];
13289  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr_up, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13290  }
13291  __pyx_pybuffernd_q_kr_up.diminfo[0].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr_up.diminfo[0].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr_up.diminfo[1].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr_up.diminfo[1].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[1];
13292  {
13293  __Pyx_BufFmt_StackElem __pyx_stack[1];
13294  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_flin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13295  }
13296  __pyx_pybuffernd_q_flin.diminfo[0].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_flin.diminfo[0].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_flin.diminfo[1].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_flin.diminfo[1].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_flin.diminfo[2].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_flin.diminfo[2].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[2];
13297  {
13298  __Pyx_BufFmt_StackElem __pyx_stack[1];
13299  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_alin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13300  }
13301  __pyx_pybuffernd_q_alin.diminfo[0].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_alin.diminfo[0].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_alin.diminfo[1].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_alin.diminfo[1].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_alin.diminfo[2].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_alin.diminfo[2].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[2];
13302  {
13303  __Pyx_BufFmt_StackElem __pyx_stack[1];
13304  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementJacobian, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13305  }
13306  __pyx_pybuffernd_elementJacobian.diminfo[0].strides = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementJacobian.diminfo[0].shape = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementJacobian.diminfo[1].strides = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementJacobian.diminfo[1].shape = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_elementJacobian.diminfo[2].strides = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_elementJacobian.diminfo[2].shape = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.shape[2];
13307 
13308  /* "subsurfaceTransportFunctions.pyx":620
13309  *
13310  * """
13311  * cdef int upwindFlag = 1 # <<<<<<<<<<<<<<
13312  * cdef int picard = 1
13313  * #check some sizes
13314  */
13315  __pyx_v_upwindFlag = 1;
13316 
13317  /* "subsurfaceTransportFunctions.pyx":621
13318  * """
13319  * cdef int upwindFlag = 1
13320  * cdef int picard = 1 # <<<<<<<<<<<<<<
13321  * #check some sizes
13322  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
13323  */
13324  __pyx_v_picard = 1;
13325 
13326  /* "subsurfaceTransportFunctions.pyx":623
13327  * cdef int picard = 1
13328  * #check some sizes
13329  * for q in [q_u,q_m,q_mt,q_r,q_kr]: # <<<<<<<<<<<<<<
13330  * assert q.shape[1] == nSpace+1
13331  * assert nDOF_test_element == nSpace+1
13332  */
13333  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error)
13334  __Pyx_GOTREF(__pyx_t_1);
13335  __Pyx_INCREF(((PyObject *)__pyx_v_q_u));
13336  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_u));
13337  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_q_u));
13338  __Pyx_INCREF(((PyObject *)__pyx_v_q_m));
13339  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_m));
13340  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_q_m));
13341  __Pyx_INCREF(((PyObject *)__pyx_v_q_mt));
13342  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_mt));
13343  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_q_mt));
13344  __Pyx_INCREF(((PyObject *)__pyx_v_q_r));
13345  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_r));
13346  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_q_r));
13347  __Pyx_INCREF(((PyObject *)__pyx_v_q_kr));
13348  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_kr));
13349  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_q_kr));
13350  __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
13351  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13352  for (;;) {
13353  if (__pyx_t_3 >= 5) break;
13354  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13355  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 623, __pyx_L1_error)
13356  #else
13357  __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error)
13358  __Pyx_GOTREF(__pyx_t_1);
13359  #endif
13360  __Pyx_XDECREF_SET(__pyx_v_q, __pyx_t_1);
13361  __pyx_t_1 = 0;
13362 
13363  /* "subsurfaceTransportFunctions.pyx":624
13364  * #check some sizes
13365  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
13366  * assert q.shape[1] == nSpace+1 # <<<<<<<<<<<<<<
13367  * assert nDOF_test_element == nSpace+1
13368  * cdef int nnz = rowptr[nSpace]
13369  */
13370  #ifndef CYTHON_WITHOUT_ASSERTIONS
13371  if (unlikely(!Py_OptimizeFlag)) {
13372  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_q, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error)
13373  __Pyx_GOTREF(__pyx_t_1);
13374  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 624, __pyx_L1_error)
13375  __Pyx_GOTREF(__pyx_t_4);
13376  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13377  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_nSpace + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error)
13378  __Pyx_GOTREF(__pyx_t_1);
13379  __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 624, __pyx_L1_error)
13380  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13381  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13382  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 624, __pyx_L1_error)
13383  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13384  if (unlikely(!__pyx_t_6)) {
13385  PyErr_SetNone(PyExc_AssertionError);
13386  __PYX_ERR(0, 624, __pyx_L1_error)
13387  }
13388  }
13389  #endif
13390 
13391  /* "subsurfaceTransportFunctions.pyx":623
13392  * cdef int picard = 1
13393  * #check some sizes
13394  * for q in [q_u,q_m,q_mt,q_r,q_kr]: # <<<<<<<<<<<<<<
13395  * assert q.shape[1] == nSpace+1
13396  * assert nDOF_test_element == nSpace+1
13397  */
13398  }
13399  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13400 
13401  /* "subsurfaceTransportFunctions.pyx":625
13402  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
13403  * assert q.shape[1] == nSpace+1
13404  * assert nDOF_test_element == nSpace+1 # <<<<<<<<<<<<<<
13405  * cdef int nnz = rowptr[nSpace]
13406  * #temporaries
13407  */
13408  #ifndef CYTHON_WITHOUT_ASSERTIONS
13409  if (unlikely(!Py_OptimizeFlag)) {
13410  if (unlikely(!((__pyx_v_nDOF_test_element == (__pyx_v_nSpace + 1)) != 0))) {
13411  PyErr_SetNone(PyExc_AssertionError);
13412  __PYX_ERR(0, 625, __pyx_L1_error)
13413  }
13414  }
13415  #endif
13416 
13417  /* "subsurfaceTransportFunctions.pyx":626
13418  * assert q.shape[1] == nSpace+1
13419  * assert nDOF_test_element == nSpace+1
13420  * cdef int nnz = rowptr[nSpace] # <<<<<<<<<<<<<<
13421  * #temporaries
13422  * cdef double u_eN,kr_eN,phi_eN,u_neig,kr_neig,phi_neig,dkr_up
13423  */
13424  __pyx_t_7 = __pyx_v_nSpace;
13425  __pyx_t_8 = -1;
13426  if (__pyx_t_7 < 0) {
13427  __pyx_t_7 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
13428  if (unlikely(__pyx_t_7 < 0)) __pyx_t_8 = 0;
13429  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_8 = 0;
13430  if (unlikely(__pyx_t_8 != -1)) {
13431  __Pyx_RaiseBufferIndexError(__pyx_t_8);
13432  __PYX_ERR(0, 626, __pyx_L1_error)
13433  }
13434  __pyx_v_nnz = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_rowptr.diminfo[0].strides));
13435 
13436  /* "subsurfaceTransportFunctions.pyx":630
13437  * cdef double u_eN,kr_eN,phi_eN,u_neig,kr_neig,phi_neig,dkr_up
13438  * cdef int eN,eN_neighbor,ii,I
13439  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_up= numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
13440  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d')
13441  * #for averaging/integration weights
13442  */
13443  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 630, __pyx_L1_error)
13444  __Pyx_GOTREF(__pyx_t_5);
13445  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 630, __pyx_L1_error)
13446  __Pyx_GOTREF(__pyx_t_1);
13447  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13448  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 630, __pyx_L1_error)
13449  __Pyx_GOTREF(__pyx_t_5);
13450  __pyx_t_4 = NULL;
13451  __pyx_t_8 = 0;
13452  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
13453  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
13454  if (likely(__pyx_t_4)) {
13455  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
13456  __Pyx_INCREF(__pyx_t_4);
13457  __Pyx_INCREF(function);
13458  __Pyx_DECREF_SET(__pyx_t_1, function);
13459  __pyx_t_8 = 1;
13460  }
13461  }
13462  #if CYTHON_FAST_PYCALL
13463  if (PyFunction_Check(__pyx_t_1)) {
13464  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
13465  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 630, __pyx_L1_error)
13466  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
13467  __Pyx_GOTREF(__pyx_t_2);
13468  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13469  } else
13470  #endif
13471  #if CYTHON_FAST_PYCCALL
13472  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
13473  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
13474  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 630, __pyx_L1_error)
13475  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
13476  __Pyx_GOTREF(__pyx_t_2);
13477  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13478  } else
13479  #endif
13480  {
13481  __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 630, __pyx_L1_error)
13482  __Pyx_GOTREF(__pyx_t_9);
13483  if (__pyx_t_4) {
13484  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL;
13485  }
13486  __Pyx_GIVEREF(__pyx_t_5);
13487  PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_5);
13488  __Pyx_INCREF(__pyx_n_s_d);
13489  __Pyx_GIVEREF(__pyx_n_s_d);
13490  PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_n_s_d);
13491  __pyx_t_5 = 0;
13492  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 630, __pyx_L1_error)
13493  __Pyx_GOTREF(__pyx_t_2);
13494  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13495  }
13496  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13497  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 630, __pyx_L1_error)
13498  __pyx_t_10 = ((PyArrayObject *)__pyx_t_2);
13499  {
13500  __Pyx_BufFmt_StackElem __pyx_stack[1];
13501  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
13502  __pyx_v_a_up = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf = NULL;
13503  __PYX_ERR(0, 630, __pyx_L1_error)
13504  } else {__pyx_pybuffernd_a_up.diminfo[0].strides = __pyx_pybuffernd_a_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_up.diminfo[0].shape = __pyx_pybuffernd_a_up.rcbuffer->pybuffer.shape[0];
13505  }
13506  }
13507  __pyx_t_10 = 0;
13508  __pyx_v_a_up = ((PyArrayObject *)__pyx_t_2);
13509  __pyx_t_2 = 0;
13510 
13511  /* "subsurfaceTransportFunctions.pyx":631
13512  * cdef int eN,eN_neighbor,ii,I
13513  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_up= numpy.zeros(nnz,'d')
13514  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d') # <<<<<<<<<<<<<<
13515  * #for averaging/integration weights
13516  * cdef double nAvgWeight = 1.0/(nSpace+1.)
13517  */
13518  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 631, __pyx_L1_error)
13519  __Pyx_GOTREF(__pyx_t_1);
13520  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 631, __pyx_L1_error)
13521  __Pyx_GOTREF(__pyx_t_9);
13522  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13523  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nSpace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 631, __pyx_L1_error)
13524  __Pyx_GOTREF(__pyx_t_1);
13525  __pyx_t_5 = NULL;
13526  __pyx_t_8 = 0;
13527  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
13528  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
13529  if (likely(__pyx_t_5)) {
13530  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
13531  __Pyx_INCREF(__pyx_t_5);
13532  __Pyx_INCREF(function);
13533  __Pyx_DECREF_SET(__pyx_t_9, function);
13534  __pyx_t_8 = 1;
13535  }
13536  }
13537  #if CYTHON_FAST_PYCALL
13538  if (PyFunction_Check(__pyx_t_9)) {
13539  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_n_s_d};
13540  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 631, __pyx_L1_error)
13541  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
13542  __Pyx_GOTREF(__pyx_t_2);
13543  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13544  } else
13545  #endif
13546  #if CYTHON_FAST_PYCCALL
13547  if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
13548  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_n_s_d};
13549  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 631, __pyx_L1_error)
13550  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
13551  __Pyx_GOTREF(__pyx_t_2);
13552  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13553  } else
13554  #endif
13555  {
13556  __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 631, __pyx_L1_error)
13557  __Pyx_GOTREF(__pyx_t_4);
13558  if (__pyx_t_5) {
13559  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
13560  }
13561  __Pyx_GIVEREF(__pyx_t_1);
13562  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_t_1);
13563  __Pyx_INCREF(__pyx_n_s_d);
13564  __Pyx_GIVEREF(__pyx_n_s_d);
13565  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_n_s_d);
13566  __pyx_t_1 = 0;
13567  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 631, __pyx_L1_error)
13568  __Pyx_GOTREF(__pyx_t_2);
13569  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13570  }
13571  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13572  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 631, __pyx_L1_error)
13573  __pyx_t_11 = ((PyArrayObject *)__pyx_t_2);
13574  {
13575  __Pyx_BufFmt_StackElem __pyx_stack[1];
13576  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
13577  __pyx_v_f_up = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf = NULL;
13578  __PYX_ERR(0, 631, __pyx_L1_error)
13579  } else {__pyx_pybuffernd_f_up.diminfo[0].strides = __pyx_pybuffernd_f_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_f_up.diminfo[0].shape = __pyx_pybuffernd_f_up.rcbuffer->pybuffer.shape[0];
13580  }
13581  }
13582  __pyx_t_11 = 0;
13583  __pyx_v_f_up = ((PyArrayObject *)__pyx_t_2);
13584  __pyx_t_2 = 0;
13585 
13586  /* "subsurfaceTransportFunctions.pyx":633
13587  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d')
13588  * #for averaging/integration weights
13589  * cdef double nAvgWeight = 1.0/(nSpace+1.) # <<<<<<<<<<<<<<
13590  * cdef double weight=1.0,volFactor = 1.0
13591  * cdef int thisElementIsUpwind = 1
13592  */
13593  __pyx_t_12 = (__pyx_v_nSpace + 1.);
13594  if (unlikely(__pyx_t_12 == 0)) {
13595  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
13596  __PYX_ERR(0, 633, __pyx_L1_error)
13597  }
13598  __pyx_v_nAvgWeight = (1.0 / __pyx_t_12);
13599 
13600  /* "subsurfaceTransportFunctions.pyx":634
13601  * #for averaging/integration weights
13602  * cdef double nAvgWeight = 1.0/(nSpace+1.)
13603  * cdef double weight=1.0,volFactor = 1.0 # <<<<<<<<<<<<<<
13604  * cdef int thisElementIsUpwind = 1
13605  * if nSpace == 2:
13606  */
13607  __pyx_v_weight = 1.0;
13608  __pyx_v_volFactor = 1.0;
13609 
13610  /* "subsurfaceTransportFunctions.pyx":635
13611  * cdef double nAvgWeight = 1.0/(nSpace+1.)
13612  * cdef double weight=1.0,volFactor = 1.0
13613  * cdef int thisElementIsUpwind = 1 # <<<<<<<<<<<<<<
13614  * if nSpace == 2:
13615  * volFactor = 0.5
13616  */
13617  __pyx_v_thisElementIsUpwind = 1;
13618 
13619  /* "subsurfaceTransportFunctions.pyx":636
13620  * cdef double weight=1.0,volFactor = 1.0
13621  * cdef int thisElementIsUpwind = 1
13622  * if nSpace == 2: # <<<<<<<<<<<<<<
13623  * volFactor = 0.5
13624  * if nSpace == 3:
13625  */
13626  __pyx_t_6 = ((__pyx_v_nSpace == 2) != 0);
13627  if (__pyx_t_6) {
13628 
13629  /* "subsurfaceTransportFunctions.pyx":637
13630  * cdef int thisElementIsUpwind = 1
13631  * if nSpace == 2:
13632  * volFactor = 0.5 # <<<<<<<<<<<<<<
13633  * if nSpace == 3:
13634  * volFactor = 1.0/6.0
13635  */
13636  __pyx_v_volFactor = 0.5;
13637 
13638  /* "subsurfaceTransportFunctions.pyx":636
13639  * cdef double weight=1.0,volFactor = 1.0
13640  * cdef int thisElementIsUpwind = 1
13641  * if nSpace == 2: # <<<<<<<<<<<<<<
13642  * volFactor = 0.5
13643  * if nSpace == 3:
13644  */
13645  }
13646 
13647  /* "subsurfaceTransportFunctions.pyx":638
13648  * if nSpace == 2:
13649  * volFactor = 0.5
13650  * if nSpace == 3: # <<<<<<<<<<<<<<
13651  * volFactor = 1.0/6.0
13652  * #
13653  */
13654  __pyx_t_6 = ((__pyx_v_nSpace == 3) != 0);
13655  if (__pyx_t_6) {
13656 
13657  /* "subsurfaceTransportFunctions.pyx":639
13658  * volFactor = 0.5
13659  * if nSpace == 3:
13660  * volFactor = 1.0/6.0 # <<<<<<<<<<<<<<
13661  * #
13662  * for eN in range(nElements_global):
13663  */
13664  __pyx_v_volFactor = (1.0 / 6.0);
13665 
13666  /* "subsurfaceTransportFunctions.pyx":638
13667  * if nSpace == 2:
13668  * volFactor = 0.5
13669  * if nSpace == 3: # <<<<<<<<<<<<<<
13670  * volFactor = 1.0/6.0
13671  * #
13672  */
13673  }
13674 
13675  /* "subsurfaceTransportFunctions.pyx":641
13676  * volFactor = 1.0/6.0
13677  * #
13678  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
13679  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation
13680  * weight = nAvgWeight*volume
13681  */
13682  __pyx_t_8 = __pyx_v_nElements_global;
13683  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_8; __pyx_t_13+=1) {
13684  __pyx_v_eN = __pyx_t_13;
13685 
13686  /* "subsurfaceTransportFunctions.pyx":642
13687  * #
13688  * for eN in range(nElements_global):
13689  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation # <<<<<<<<<<<<<<
13690  * weight = nAvgWeight*volume
13691  *
13692  */
13693  __pyx_t_14 = __pyx_v_eN;
13694  __pyx_t_15 = 0;
13695  __pyx_t_16 = -1;
13696  if (__pyx_t_14 < 0) {
13697  __pyx_t_14 += __pyx_pybuffernd_q_detJ.diminfo[0].shape;
13698  if (unlikely(__pyx_t_14 < 0)) __pyx_t_16 = 0;
13699  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_q_detJ.diminfo[0].shape)) __pyx_t_16 = 0;
13700  if (__pyx_t_15 < 0) {
13701  __pyx_t_15 += __pyx_pybuffernd_q_detJ.diminfo[1].shape;
13702  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
13703  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_detJ.diminfo[1].shape)) __pyx_t_16 = 1;
13704  if (unlikely(__pyx_t_16 != -1)) {
13705  __Pyx_RaiseBufferIndexError(__pyx_t_16);
13706  __PYX_ERR(0, 642, __pyx_L1_error)
13707  }
13708  __pyx_v_volume = (__pyx_v_volFactor * fabs((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_q_detJ.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_detJ.diminfo[1].strides))));
13709 
13710  /* "subsurfaceTransportFunctions.pyx":643
13711  * for eN in range(nElements_global):
13712  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation
13713  * weight = nAvgWeight*volume # <<<<<<<<<<<<<<
13714  *
13715  *
13716  */
13717  __pyx_v_weight = (__pyx_v_nAvgWeight * __pyx_v_volume);
13718 
13719  /* "subsurfaceTransportFunctions.pyx":646
13720  *
13721  *
13722  * for i in range(nDOF_test_element): # <<<<<<<<<<<<<<
13723  * #nodal quadrature so diagonal
13724  * ##mass
13725  */
13726  __pyx_t_16 = __pyx_v_nDOF_test_element;
13727  for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
13728  __pyx_v_i = __pyx_t_17;
13729 
13730  /* "subsurfaceTransportFunctions.pyx":650
13731  * ##mass
13732  * #elementResidual[eN,i] += weight*q_m[eN,i]
13733  * elementJacobian[eN,i,i] += weight*q_dmt[eN,i] # <<<<<<<<<<<<<<
13734  *
13735  * #have to actually compute loop over other nodes for stiffness terms
13736  */
13737  __pyx_t_18 = __pyx_v_eN;
13738  __pyx_t_19 = __pyx_v_i;
13739  __pyx_t_20 = -1;
13740  if (__pyx_t_18 < 0) {
13741  __pyx_t_18 += __pyx_pybuffernd_q_dmt.diminfo[0].shape;
13742  if (unlikely(__pyx_t_18 < 0)) __pyx_t_20 = 0;
13743  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_q_dmt.diminfo[0].shape)) __pyx_t_20 = 0;
13744  if (__pyx_t_19 < 0) {
13745  __pyx_t_19 += __pyx_pybuffernd_q_dmt.diminfo[1].shape;
13746  if (unlikely(__pyx_t_19 < 0)) __pyx_t_20 = 1;
13747  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_q_dmt.diminfo[1].shape)) __pyx_t_20 = 1;
13748  if (unlikely(__pyx_t_20 != -1)) {
13749  __Pyx_RaiseBufferIndexError(__pyx_t_20);
13750  __PYX_ERR(0, 650, __pyx_L1_error)
13751  }
13752  __pyx_t_21 = __pyx_v_eN;
13753  __pyx_t_22 = __pyx_v_i;
13754  __pyx_t_23 = __pyx_v_i;
13755  __pyx_t_20 = -1;
13756  if (__pyx_t_21 < 0) {
13757  __pyx_t_21 += __pyx_pybuffernd_elementJacobian.diminfo[0].shape;
13758  if (unlikely(__pyx_t_21 < 0)) __pyx_t_20 = 0;
13759  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_elementJacobian.diminfo[0].shape)) __pyx_t_20 = 0;
13760  if (__pyx_t_22 < 0) {
13761  __pyx_t_22 += __pyx_pybuffernd_elementJacobian.diminfo[1].shape;
13762  if (unlikely(__pyx_t_22 < 0)) __pyx_t_20 = 1;
13763  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_elementJacobian.diminfo[1].shape)) __pyx_t_20 = 1;
13764  if (__pyx_t_23 < 0) {
13765  __pyx_t_23 += __pyx_pybuffernd_elementJacobian.diminfo[2].shape;
13766  if (unlikely(__pyx_t_23 < 0)) __pyx_t_20 = 2;
13767  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_elementJacobian.diminfo[2].shape)) __pyx_t_20 = 2;
13768  if (unlikely(__pyx_t_20 != -1)) {
13769  __Pyx_RaiseBufferIndexError(__pyx_t_20);
13770  __PYX_ERR(0, 650, __pyx_L1_error)
13771  }
13772  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_elementJacobian.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_elementJacobian.diminfo[1].strides, __pyx_t_23, __pyx_pybuffernd_elementJacobian.diminfo[2].strides) += (__pyx_v_weight * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_q_dmt.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_q_dmt.diminfo[1].strides)));
13773 
13774  /* "subsurfaceTransportFunctions.pyx":653
13775  *
13776  * #have to actually compute loop over other nodes for stiffness terms
13777  * for ebN in range(nElementBoundaries_element): #same as nDOF_trial , nElementBoundaries_ # <<<<<<<<<<<<<<
13778  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
13779  * for ii in range(nnz):
13780  */
13781  __pyx_t_20 = __pyx_v_nElementBoundaries_element;
13782  for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_20; __pyx_t_24+=1) {
13783  __pyx_v_ebN = __pyx_t_24;
13784 
13785  /* "subsurfaceTransportFunctions.pyx":655
13786  * for ebN in range(nElementBoundaries_element): #same as nDOF_trial , nElementBoundaries_
13787  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
13788  * for ii in range(nnz): # <<<<<<<<<<<<<<
13789  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
13790  * for I in range(nSpace):
13791  */
13792  __pyx_t_25 = __pyx_v_nnz;
13793  for (__pyx_t_26 = 0; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) {
13794  __pyx_v_ii = __pyx_t_26;
13795 
13796  /* "subsurfaceTransportFunctions.pyx":656
13797  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
13798  * for ii in range(nnz):
13799  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN] # <<<<<<<<<<<<<<
13800  * for I in range(nSpace):
13801  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN]
13802  */
13803  __pyx_t_27 = __pyx_v_eN;
13804  __pyx_t_28 = __pyx_v_ebN;
13805  __pyx_t_29 = __pyx_v_ii;
13806  __pyx_t_30 = -1;
13807  if (__pyx_t_27 < 0) {
13808  __pyx_t_27 += __pyx_pybuffernd_q_alin.diminfo[0].shape;
13809  if (unlikely(__pyx_t_27 < 0)) __pyx_t_30 = 0;
13810  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_q_alin.diminfo[0].shape)) __pyx_t_30 = 0;
13811  if (__pyx_t_28 < 0) {
13812  __pyx_t_28 += __pyx_pybuffernd_q_alin.diminfo[1].shape;
13813  if (unlikely(__pyx_t_28 < 0)) __pyx_t_30 = 1;
13814  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_q_alin.diminfo[1].shape)) __pyx_t_30 = 1;
13815  if (__pyx_t_29 < 0) {
13816  __pyx_t_29 += __pyx_pybuffernd_q_alin.diminfo[2].shape;
13817  if (unlikely(__pyx_t_29 < 0)) __pyx_t_30 = 2;
13818  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_q_alin.diminfo[2].shape)) __pyx_t_30 = 2;
13819  if (unlikely(__pyx_t_30 != -1)) {
13820  __Pyx_RaiseBufferIndexError(__pyx_t_30);
13821  __PYX_ERR(0, 656, __pyx_L1_error)
13822  }
13823  __pyx_t_31 = __pyx_v_eN;
13824  __pyx_t_32 = __pyx_v_ebN;
13825  __pyx_t_30 = -1;
13826  if (__pyx_t_31 < 0) {
13827  __pyx_t_31 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
13828  if (unlikely(__pyx_t_31 < 0)) __pyx_t_30 = 0;
13829  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_30 = 0;
13830  if (__pyx_t_32 < 0) {
13831  __pyx_t_32 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
13832  if (unlikely(__pyx_t_32 < 0)) __pyx_t_30 = 1;
13833  } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_30 = 1;
13834  if (unlikely(__pyx_t_30 != -1)) {
13835  __Pyx_RaiseBufferIndexError(__pyx_t_30);
13836  __PYX_ERR(0, 656, __pyx_L1_error)
13837  }
13838  __pyx_t_33 = __pyx_v_ii;
13839  __pyx_t_30 = -1;
13840  if (__pyx_t_33 < 0) {
13841  __pyx_t_33 += __pyx_pybuffernd_a_up.diminfo[0].shape;
13842  if (unlikely(__pyx_t_33 < 0)) __pyx_t_30 = 0;
13843  } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_a_up.diminfo[0].shape)) __pyx_t_30 = 0;
13844  if (unlikely(__pyx_t_30 != -1)) {
13845  __Pyx_RaiseBufferIndexError(__pyx_t_30);
13846  __PYX_ERR(0, 656, __pyx_L1_error)
13847  }
13848  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_a_up.diminfo[0].strides) = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_q_alin.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_q_alin.diminfo[1].strides, __pyx_t_29, __pyx_pybuffernd_q_alin.diminfo[2].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_q_kr_up.diminfo[1].strides)));
13849  }
13850 
13851  /* "subsurfaceTransportFunctions.pyx":657
13852  * for ii in range(nnz):
13853  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
13854  * for I in range(nSpace): # <<<<<<<<<<<<<<
13855  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN]
13856  * #
13857  */
13858  __pyx_t_25 = __pyx_v_nSpace;
13859  for (__pyx_t_26 = 0; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) {
13860  __pyx_v_I = __pyx_t_26;
13861 
13862  /* "subsurfaceTransportFunctions.pyx":658
13863  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
13864  * for I in range(nSpace):
13865  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN] # <<<<<<<<<<<<<<
13866  * #
13867  *
13868  */
13869  __pyx_t_34 = __pyx_v_eN;
13870  __pyx_t_35 = __pyx_v_ebN;
13871  __pyx_t_36 = __pyx_v_I;
13872  __pyx_t_30 = -1;
13873  if (__pyx_t_34 < 0) {
13874  __pyx_t_34 += __pyx_pybuffernd_q_flin.diminfo[0].shape;
13875  if (unlikely(__pyx_t_34 < 0)) __pyx_t_30 = 0;
13876  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_q_flin.diminfo[0].shape)) __pyx_t_30 = 0;
13877  if (__pyx_t_35 < 0) {
13878  __pyx_t_35 += __pyx_pybuffernd_q_flin.diminfo[1].shape;
13879  if (unlikely(__pyx_t_35 < 0)) __pyx_t_30 = 1;
13880  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_q_flin.diminfo[1].shape)) __pyx_t_30 = 1;
13881  if (__pyx_t_36 < 0) {
13882  __pyx_t_36 += __pyx_pybuffernd_q_flin.diminfo[2].shape;
13883  if (unlikely(__pyx_t_36 < 0)) __pyx_t_30 = 2;
13884  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_q_flin.diminfo[2].shape)) __pyx_t_30 = 2;
13885  if (unlikely(__pyx_t_30 != -1)) {
13886  __Pyx_RaiseBufferIndexError(__pyx_t_30);
13887  __PYX_ERR(0, 658, __pyx_L1_error)
13888  }
13889  __pyx_t_37 = __pyx_v_eN;
13890  __pyx_t_38 = __pyx_v_ebN;
13891  __pyx_t_30 = -1;
13892  if (__pyx_t_37 < 0) {
13893  __pyx_t_37 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
13894  if (unlikely(__pyx_t_37 < 0)) __pyx_t_30 = 0;
13895  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_30 = 0;
13896  if (__pyx_t_38 < 0) {
13897  __pyx_t_38 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
13898  if (unlikely(__pyx_t_38 < 0)) __pyx_t_30 = 1;
13899  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_30 = 1;
13900  if (unlikely(__pyx_t_30 != -1)) {
13901  __Pyx_RaiseBufferIndexError(__pyx_t_30);
13902  __PYX_ERR(0, 658, __pyx_L1_error)
13903  }
13904  __pyx_t_39 = __pyx_v_I;
13905  __pyx_t_30 = -1;
13906  if (__pyx_t_39 < 0) {
13907  __pyx_t_39 += __pyx_pybuffernd_f_up.diminfo[0].shape;
13908  if (unlikely(__pyx_t_39 < 0)) __pyx_t_30 = 0;
13909  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_f_up.diminfo[0].shape)) __pyx_t_30 = 0;
13910  if (unlikely(__pyx_t_30 != -1)) {
13911  __Pyx_RaiseBufferIndexError(__pyx_t_30);
13912  __PYX_ERR(0, 658, __pyx_L1_error)
13913  }
13914  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_f_up.diminfo[0].strides) = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_q_flin.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_q_flin.diminfo[1].strides, __pyx_t_36, __pyx_pybuffernd_q_flin.diminfo[2].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_q_kr_up.diminfo[1].strides)));
13915  }
13916 
13917  /* "subsurfaceTransportFunctions.pyx":662
13918  *
13919  * #Picard part first
13920  * for j in range(nDOF_trial_element): # <<<<<<<<<<<<<<
13921  * for I in range(nSpace):
13922  * for ii in range(rowptr[I],rowptr[I+1]):
13923  */
13924  __pyx_t_25 = __pyx_v_nDOF_trial_element;
13925  for (__pyx_t_26 = 0; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) {
13926  __pyx_v_j = __pyx_t_26;
13927 
13928  /* "subsurfaceTransportFunctions.pyx":663
13929  * #Picard part first
13930  * for j in range(nDOF_trial_element):
13931  * for I in range(nSpace): # <<<<<<<<<<<<<<
13932  * for ii in range(rowptr[I],rowptr[I+1]):
13933  * elementJacobian[eN,i,j] += weight*a_up[ii]*q_grad_v[eN,ebN,j,colind[ii]]*q_grad_w[eN,ebN,i,I]
13934  */
13935  __pyx_t_30 = __pyx_v_nSpace;
13936  for (__pyx_t_40 = 0; __pyx_t_40 < __pyx_t_30; __pyx_t_40+=1) {
13937  __pyx_v_I = __pyx_t_40;
13938 
13939  /* "subsurfaceTransportFunctions.pyx":664
13940  * for j in range(nDOF_trial_element):
13941  * for I in range(nSpace):
13942  * for ii in range(rowptr[I],rowptr[I+1]): # <<<<<<<<<<<<<<
13943  * elementJacobian[eN,i,j] += weight*a_up[ii]*q_grad_v[eN,ebN,j,colind[ii]]*q_grad_w[eN,ebN,i,I]
13944  * #j picard
13945  */
13946  __pyx_t_41 = (__pyx_v_I + 1);
13947  __pyx_t_42 = -1;
13948  if (__pyx_t_41 < 0) {
13949  __pyx_t_41 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
13950  if (unlikely(__pyx_t_41 < 0)) __pyx_t_42 = 0;
13951  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_42 = 0;
13952  if (unlikely(__pyx_t_42 != -1)) {
13953  __Pyx_RaiseBufferIndexError(__pyx_t_42);
13954  __PYX_ERR(0, 664, __pyx_L1_error)
13955  }
13956  __pyx_t_43 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_rowptr.diminfo[0].strides));
13957  __pyx_t_44 = __pyx_v_I;
13958  __pyx_t_42 = -1;
13959  if (__pyx_t_44 < 0) {
13960  __pyx_t_44 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
13961  if (unlikely(__pyx_t_44 < 0)) __pyx_t_42 = 0;
13962  } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_42 = 0;
13963  if (unlikely(__pyx_t_42 != -1)) {
13964  __Pyx_RaiseBufferIndexError(__pyx_t_42);
13965  __PYX_ERR(0, 664, __pyx_L1_error)
13966  }
13967  for (__pyx_t_42 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_rowptr.diminfo[0].strides)); __pyx_t_42 < __pyx_t_43; __pyx_t_42+=1) {
13968  __pyx_v_ii = __pyx_t_42;
13969 
13970  /* "subsurfaceTransportFunctions.pyx":665
13971  * for I in range(nSpace):
13972  * for ii in range(rowptr[I],rowptr[I+1]):
13973  * elementJacobian[eN,i,j] += weight*a_up[ii]*q_grad_v[eN,ebN,j,colind[ii]]*q_grad_w[eN,ebN,i,I] # <<<<<<<<<<<<<<
13974  * #j picard
13975  * #i
13976  */
13977  __pyx_t_45 = __pyx_v_ii;
13978  __pyx_t_46 = -1;
13979  if (__pyx_t_45 < 0) {
13980  __pyx_t_45 += __pyx_pybuffernd_a_up.diminfo[0].shape;
13981  if (unlikely(__pyx_t_45 < 0)) __pyx_t_46 = 0;
13982  } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_a_up.diminfo[0].shape)) __pyx_t_46 = 0;
13983  if (unlikely(__pyx_t_46 != -1)) {
13984  __Pyx_RaiseBufferIndexError(__pyx_t_46);
13985  __PYX_ERR(0, 665, __pyx_L1_error)
13986  }
13987  __pyx_t_47 = __pyx_v_ii;
13988  __pyx_t_46 = -1;
13989  if (__pyx_t_47 < 0) {
13990  __pyx_t_47 += __pyx_pybuffernd_colind.diminfo[0].shape;
13991  if (unlikely(__pyx_t_47 < 0)) __pyx_t_46 = 0;
13992  } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_colind.diminfo[0].shape)) __pyx_t_46 = 0;
13993  if (unlikely(__pyx_t_46 != -1)) {
13994  __Pyx_RaiseBufferIndexError(__pyx_t_46);
13995  __PYX_ERR(0, 665, __pyx_L1_error)
13996  }
13997  __pyx_t_48 = __pyx_v_eN;
13998  __pyx_t_49 = __pyx_v_ebN;
13999  __pyx_t_50 = __pyx_v_j;
14000  __pyx_t_51 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_colind.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_colind.diminfo[0].strides));
14001  __pyx_t_46 = -1;
14002  if (__pyx_t_48 < 0) {
14003  __pyx_t_48 += __pyx_pybuffernd_q_grad_v.diminfo[0].shape;
14004  if (unlikely(__pyx_t_48 < 0)) __pyx_t_46 = 0;
14005  } else if (unlikely(__pyx_t_48 >= __pyx_pybuffernd_q_grad_v.diminfo[0].shape)) __pyx_t_46 = 0;
14006  if (__pyx_t_49 < 0) {
14007  __pyx_t_49 += __pyx_pybuffernd_q_grad_v.diminfo[1].shape;
14008  if (unlikely(__pyx_t_49 < 0)) __pyx_t_46 = 1;
14009  } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_q_grad_v.diminfo[1].shape)) __pyx_t_46 = 1;
14010  if (__pyx_t_50 < 0) {
14011  __pyx_t_50 += __pyx_pybuffernd_q_grad_v.diminfo[2].shape;
14012  if (unlikely(__pyx_t_50 < 0)) __pyx_t_46 = 2;
14013  } else if (unlikely(__pyx_t_50 >= __pyx_pybuffernd_q_grad_v.diminfo[2].shape)) __pyx_t_46 = 2;
14014  if (__pyx_t_51 < 0) {
14015  __pyx_t_51 += __pyx_pybuffernd_q_grad_v.diminfo[3].shape;
14016  if (unlikely(__pyx_t_51 < 0)) __pyx_t_46 = 3;
14017  } else if (unlikely(__pyx_t_51 >= __pyx_pybuffernd_q_grad_v.diminfo[3].shape)) __pyx_t_46 = 3;
14018  if (unlikely(__pyx_t_46 != -1)) {
14019  __Pyx_RaiseBufferIndexError(__pyx_t_46);
14020  __PYX_ERR(0, 665, __pyx_L1_error)
14021  }
14022  __pyx_t_52 = __pyx_v_eN;
14023  __pyx_t_53 = __pyx_v_ebN;
14024  __pyx_t_54 = __pyx_v_i;
14025  __pyx_t_55 = __pyx_v_I;
14026  __pyx_t_46 = -1;
14027  if (__pyx_t_52 < 0) {
14028  __pyx_t_52 += __pyx_pybuffernd_q_grad_w.diminfo[0].shape;
14029  if (unlikely(__pyx_t_52 < 0)) __pyx_t_46 = 0;
14030  } else if (unlikely(__pyx_t_52 >= __pyx_pybuffernd_q_grad_w.diminfo[0].shape)) __pyx_t_46 = 0;
14031  if (__pyx_t_53 < 0) {
14032  __pyx_t_53 += __pyx_pybuffernd_q_grad_w.diminfo[1].shape;
14033  if (unlikely(__pyx_t_53 < 0)) __pyx_t_46 = 1;
14034  } else if (unlikely(__pyx_t_53 >= __pyx_pybuffernd_q_grad_w.diminfo[1].shape)) __pyx_t_46 = 1;
14035  if (__pyx_t_54 < 0) {
14036  __pyx_t_54 += __pyx_pybuffernd_q_grad_w.diminfo[2].shape;
14037  if (unlikely(__pyx_t_54 < 0)) __pyx_t_46 = 2;
14038  } else if (unlikely(__pyx_t_54 >= __pyx_pybuffernd_q_grad_w.diminfo[2].shape)) __pyx_t_46 = 2;
14039  if (__pyx_t_55 < 0) {
14040  __pyx_t_55 += __pyx_pybuffernd_q_grad_w.diminfo[3].shape;
14041  if (unlikely(__pyx_t_55 < 0)) __pyx_t_46 = 3;
14042  } else if (unlikely(__pyx_t_55 >= __pyx_pybuffernd_q_grad_w.diminfo[3].shape)) __pyx_t_46 = 3;
14043  if (unlikely(__pyx_t_46 != -1)) {
14044  __Pyx_RaiseBufferIndexError(__pyx_t_46);
14045  __PYX_ERR(0, 665, __pyx_L1_error)
14046  }
14047  __pyx_t_56 = __pyx_v_eN;
14048  __pyx_t_57 = __pyx_v_i;
14049  __pyx_t_58 = __pyx_v_j;
14050  __pyx_t_46 = -1;
14051  if (__pyx_t_56 < 0) {
14052  __pyx_t_56 += __pyx_pybuffernd_elementJacobian.diminfo[0].shape;
14053  if (unlikely(__pyx_t_56 < 0)) __pyx_t_46 = 0;
14054  } else if (unlikely(__pyx_t_56 >= __pyx_pybuffernd_elementJacobian.diminfo[0].shape)) __pyx_t_46 = 0;
14055  if (__pyx_t_57 < 0) {
14056  __pyx_t_57 += __pyx_pybuffernd_elementJacobian.diminfo[1].shape;
14057  if (unlikely(__pyx_t_57 < 0)) __pyx_t_46 = 1;
14058  } else if (unlikely(__pyx_t_57 >= __pyx_pybuffernd_elementJacobian.diminfo[1].shape)) __pyx_t_46 = 1;
14059  if (__pyx_t_58 < 0) {
14060  __pyx_t_58 += __pyx_pybuffernd_elementJacobian.diminfo[2].shape;
14061  if (unlikely(__pyx_t_58 < 0)) __pyx_t_46 = 2;
14062  } else if (unlikely(__pyx_t_58 >= __pyx_pybuffernd_elementJacobian.diminfo[2].shape)) __pyx_t_46 = 2;
14063  if (unlikely(__pyx_t_46 != -1)) {
14064  __Pyx_RaiseBufferIndexError(__pyx_t_46);
14065  __PYX_ERR(0, 665, __pyx_L1_error)
14066  }
14067  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_elementJacobian.diminfo[0].strides, __pyx_t_57, __pyx_pybuffernd_elementJacobian.diminfo[1].strides, __pyx_t_58, __pyx_pybuffernd_elementJacobian.diminfo[2].strides) += (((__pyx_v_weight * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_a_up.diminfo[0].strides))) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_q_grad_v.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_q_grad_v.diminfo[1].strides, __pyx_t_50, __pyx_pybuffernd_q_grad_v.diminfo[2].strides, __pyx_t_51, __pyx_pybuffernd_q_grad_v.diminfo[3].strides))) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_q_grad_w.diminfo[0].strides, __pyx_t_53, __pyx_pybuffernd_q_grad_w.diminfo[1].strides, __pyx_t_54, __pyx_pybuffernd_q_grad_w.diminfo[2].strides, __pyx_t_55, __pyx_pybuffernd_q_grad_w.diminfo[3].strides)));
14068  }
14069  }
14070  }
14071  }
14072  }
14073  }
14074 
14075  /* "subsurfaceTransportFunctions.pyx":574
14076  * #i
14077  * #eN
14078  * def RE_NCP1_getElementJacobian(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
14079  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
14080  * numpy.ndarray[ITYPE_t,ndim=1] colind,
14081  */
14082 
14083  /* function exit code */
14084  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14085  goto __pyx_L0;
14086  __pyx_L1_error:;
14087  __Pyx_XDECREF(__pyx_t_1);
14088  __Pyx_XDECREF(__pyx_t_2);
14089  __Pyx_XDECREF(__pyx_t_4);
14090  __Pyx_XDECREF(__pyx_t_5);
14091  __Pyx_XDECREF(__pyx_t_9);
14092  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
14093  __Pyx_PyThreadState_declare
14094  __Pyx_PyThreadState_assign
14095  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
14096  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer);
14097  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
14098  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
14099  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer);
14100  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
14101  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer);
14102  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
14103  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
14104  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer);
14105  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer);
14106  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dm.rcbuffer->pybuffer);
14107  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dmt.rcbuffer->pybuffer);
14108  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
14109  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer);
14110  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer);
14111  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer);
14112  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
14113  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
14114  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer);
14115  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer);
14116  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
14117  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
14118  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
14119  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
14120  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_getElementJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
14121  __pyx_r = NULL;
14122  goto __pyx_L2;
14123  __pyx_L0:;
14124  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer);
14125  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
14126  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
14127  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer);
14128  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
14129  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer);
14130  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
14131  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
14132  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer);
14133  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer);
14134  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dm.rcbuffer->pybuffer);
14135  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dmt.rcbuffer->pybuffer);
14136  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
14137  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer);
14138  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer);
14139  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer);
14140  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
14141  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
14142  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer);
14143  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer);
14144  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
14145  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
14146  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
14147  __pyx_L2:;
14148  __Pyx_XDECREF(__pyx_v_q);
14149  __Pyx_XDECREF((PyObject *)__pyx_v_a_up);
14150  __Pyx_XDECREF((PyObject *)__pyx_v_f_up);
14151  __Pyx_XGIVEREF(__pyx_r);
14152  __Pyx_RefNannyFinishContext();
14153  return __pyx_r;
14154 }
14155 
14156 /* "subsurfaceTransportFunctions.pyx":673
14157  * ##################################################
14158  *
14159  * def updateMass_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] mt, # <<<<<<<<<<<<<<
14160  * numpy.ndarray[DTYPE_t,ndim=3] w,
14161  * numpy.ndarray[DTYPE_t,ndim=2] dV,
14162  */
14163 
14164 /* Python wrapper */
14165 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_37updateMass_weakAvg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
14166 static char __pyx_doc_28subsurfaceTransportFunctions_36updateMass_weakAvg[] = "\n approximate element mass term as (\010ar{c}_e,w_{h,i})_e\n ";
14167 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_37updateMass_weakAvg = {"updateMass_weakAvg", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_37updateMass_weakAvg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_36updateMass_weakAvg};
14168 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_37updateMass_weakAvg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
14169  PyArrayObject *__pyx_v_mt = 0;
14170  PyArrayObject *__pyx_v_w = 0;
14171  PyArrayObject *__pyx_v_dV = 0;
14172  PyArrayObject *__pyx_v_weak_residual = 0;
14173  PyObject *__pyx_r = 0;
14174  __Pyx_RefNannyDeclarations
14175  __Pyx_RefNannySetupContext("updateMass_weakAvg (wrapper)", 0);
14176  {
14177  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mt,&__pyx_n_s_w,&__pyx_n_s_dV,&__pyx_n_s_weak_residual,0};
14178  PyObject* values[4] = {0,0,0,0};
14179  if (unlikely(__pyx_kwds)) {
14180  Py_ssize_t kw_args;
14181  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
14182  switch (pos_args) {
14183  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
14184  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
14185  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14186  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14187  case 0: break;
14188  default: goto __pyx_L5_argtuple_error;
14189  }
14190  kw_args = PyDict_Size(__pyx_kwds);
14191  switch (pos_args) {
14192  case 0:
14193  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mt)) != 0)) kw_args--;
14194  else goto __pyx_L5_argtuple_error;
14195  case 1:
14196  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
14197  else {
14198  __Pyx_RaiseArgtupleInvalid("updateMass_weakAvg", 1, 4, 4, 1); __PYX_ERR(0, 673, __pyx_L3_error)
14199  }
14200  case 2:
14201  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dV)) != 0)) kw_args--;
14202  else {
14203  __Pyx_RaiseArgtupleInvalid("updateMass_weakAvg", 1, 4, 4, 2); __PYX_ERR(0, 673, __pyx_L3_error)
14204  }
14205  case 3:
14206  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_weak_residual)) != 0)) kw_args--;
14207  else {
14208  __Pyx_RaiseArgtupleInvalid("updateMass_weakAvg", 1, 4, 4, 3); __PYX_ERR(0, 673, __pyx_L3_error)
14209  }
14210  }
14211  if (unlikely(kw_args > 0)) {
14212  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateMass_weakAvg") < 0)) __PYX_ERR(0, 673, __pyx_L3_error)
14213  }
14214  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
14215  goto __pyx_L5_argtuple_error;
14216  } else {
14217  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14218  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14219  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
14220  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
14221  }
14222  __pyx_v_mt = ((PyArrayObject *)values[0]);
14223  __pyx_v_w = ((PyArrayObject *)values[1]);
14224  __pyx_v_dV = ((PyArrayObject *)values[2]);
14225  __pyx_v_weak_residual = ((PyArrayObject *)values[3]);
14226  }
14227  goto __pyx_L4_argument_unpacking_done;
14228  __pyx_L5_argtuple_error:;
14229  __Pyx_RaiseArgtupleInvalid("updateMass_weakAvg", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 673, __pyx_L3_error)
14230  __pyx_L3_error:;
14231  __Pyx_AddTraceback("subsurfaceTransportFunctions.updateMass_weakAvg", __pyx_clineno, __pyx_lineno, __pyx_filename);
14232  __Pyx_RefNannyFinishContext();
14233  return NULL;
14234  __pyx_L4_argument_unpacking_done:;
14235  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mt), __pyx_ptype_5numpy_ndarray, 1, "mt", 0))) __PYX_ERR(0, 673, __pyx_L1_error)
14236  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) __PYX_ERR(0, 674, __pyx_L1_error)
14237  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dV), __pyx_ptype_5numpy_ndarray, 1, "dV", 0))) __PYX_ERR(0, 675, __pyx_L1_error)
14238  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weak_residual), __pyx_ptype_5numpy_ndarray, 1, "weak_residual", 0))) __PYX_ERR(0, 676, __pyx_L1_error)
14239  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_36updateMass_weakAvg(__pyx_self, __pyx_v_mt, __pyx_v_w, __pyx_v_dV, __pyx_v_weak_residual);
14240 
14241  /* function exit code */
14242  goto __pyx_L0;
14243  __pyx_L1_error:;
14244  __pyx_r = NULL;
14245  __pyx_L0:;
14246  __Pyx_RefNannyFinishContext();
14247  return __pyx_r;
14248 }
14249 
14250 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_36updateMass_weakAvg(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mt, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_dV, PyArrayObject *__pyx_v_weak_residual) {
14251  int __pyx_v_eN;
14252  int __pyx_v_i;
14253  int __pyx_v_k;
14254  PyObject *__pyx_v_mt_avg = 0;
14255  PyObject *__pyx_v_vol = 0;
14256  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
14257  __Pyx_Buffer __pyx_pybuffer_dV;
14258  __Pyx_LocalBuf_ND __pyx_pybuffernd_mt;
14259  __Pyx_Buffer __pyx_pybuffer_mt;
14260  __Pyx_LocalBuf_ND __pyx_pybuffernd_w;
14261  __Pyx_Buffer __pyx_pybuffer_w;
14262  __Pyx_LocalBuf_ND __pyx_pybuffernd_weak_residual;
14263  __Pyx_Buffer __pyx_pybuffer_weak_residual;
14264  PyObject *__pyx_r = NULL;
14265  __Pyx_RefNannyDeclarations
14266  npy_intp __pyx_t_1;
14267  int __pyx_t_2;
14268  npy_intp __pyx_t_3;
14269  int __pyx_t_4;
14270  Py_ssize_t __pyx_t_5;
14271  Py_ssize_t __pyx_t_6;
14272  int __pyx_t_7;
14273  Py_ssize_t __pyx_t_8;
14274  Py_ssize_t __pyx_t_9;
14275  PyObject *__pyx_t_10 = NULL;
14276  PyObject *__pyx_t_11 = NULL;
14277  Py_ssize_t __pyx_t_12;
14278  Py_ssize_t __pyx_t_13;
14279  Py_ssize_t __pyx_t_14;
14280  Py_ssize_t __pyx_t_15;
14281  Py_ssize_t __pyx_t_16;
14282  Py_ssize_t __pyx_t_17;
14283  Py_ssize_t __pyx_t_18;
14284  PyObject *__pyx_t_19 = NULL;
14285  double __pyx_t_20;
14286  Py_ssize_t __pyx_t_21;
14287  Py_ssize_t __pyx_t_22;
14288  __Pyx_RefNannySetupContext("updateMass_weakAvg", 0);
14289  __pyx_pybuffer_mt.pybuffer.buf = NULL;
14290  __pyx_pybuffer_mt.refcount = 0;
14291  __pyx_pybuffernd_mt.data = NULL;
14292  __pyx_pybuffernd_mt.rcbuffer = &__pyx_pybuffer_mt;
14293  __pyx_pybuffer_w.pybuffer.buf = NULL;
14294  __pyx_pybuffer_w.refcount = 0;
14295  __pyx_pybuffernd_w.data = NULL;
14296  __pyx_pybuffernd_w.rcbuffer = &__pyx_pybuffer_w;
14297  __pyx_pybuffer_dV.pybuffer.buf = NULL;
14298  __pyx_pybuffer_dV.refcount = 0;
14299  __pyx_pybuffernd_dV.data = NULL;
14300  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
14301  __pyx_pybuffer_weak_residual.pybuffer.buf = NULL;
14302  __pyx_pybuffer_weak_residual.refcount = 0;
14303  __pyx_pybuffernd_weak_residual.data = NULL;
14304  __pyx_pybuffernd_weak_residual.rcbuffer = &__pyx_pybuffer_weak_residual;
14305  {
14306  __Pyx_BufFmt_StackElem __pyx_stack[1];
14307  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mt.rcbuffer->pybuffer, (PyObject*)__pyx_v_mt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 673, __pyx_L1_error)
14308  }
14309  __pyx_pybuffernd_mt.diminfo[0].strides = __pyx_pybuffernd_mt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mt.diminfo[0].shape = __pyx_pybuffernd_mt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mt.diminfo[1].strides = __pyx_pybuffernd_mt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mt.diminfo[1].shape = __pyx_pybuffernd_mt.rcbuffer->pybuffer.shape[1];
14310  {
14311  __Pyx_BufFmt_StackElem __pyx_stack[1];
14312  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 673, __pyx_L1_error)
14313  }
14314  __pyx_pybuffernd_w.diminfo[0].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_w.diminfo[0].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_w.diminfo[1].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_w.diminfo[1].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_w.diminfo[2].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_w.diminfo[2].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[2];
14315  {
14316  __Pyx_BufFmt_StackElem __pyx_stack[1];
14317  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 673, __pyx_L1_error)
14318  }
14319  __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dV.diminfo[1].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dV.diminfo[1].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[1];
14320  {
14321  __Pyx_BufFmt_StackElem __pyx_stack[1];
14322  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weak_residual.rcbuffer->pybuffer, (PyObject*)__pyx_v_weak_residual, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 673, __pyx_L1_error)
14323  }
14324  __pyx_pybuffernd_weak_residual.diminfo[0].strides = __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weak_residual.diminfo[0].shape = __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_weak_residual.diminfo[1].strides = __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_weak_residual.diminfo[1].shape = __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.shape[1];
14325 
14326  /* "subsurfaceTransportFunctions.pyx":682
14327  * cdef int eN,i,k
14328  * cdef mt_avg,vol
14329  * for eN in range(mt.shape[0]): # <<<<<<<<<<<<<<
14330  * mt_avg = 0.0
14331  * vol = 0.0
14332  */
14333  __pyx_t_1 = (__pyx_v_mt->dimensions[0]);
14334  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
14335  __pyx_v_eN = __pyx_t_2;
14336 
14337  /* "subsurfaceTransportFunctions.pyx":683
14338  * cdef mt_avg,vol
14339  * for eN in range(mt.shape[0]):
14340  * mt_avg = 0.0 # <<<<<<<<<<<<<<
14341  * vol = 0.0
14342  * for k in range(mt.shape[1]):
14343  */
14344  __Pyx_INCREF(__pyx_float_0_0);
14345  __Pyx_XDECREF_SET(__pyx_v_mt_avg, __pyx_float_0_0);
14346 
14347  /* "subsurfaceTransportFunctions.pyx":684
14348  * for eN in range(mt.shape[0]):
14349  * mt_avg = 0.0
14350  * vol = 0.0 # <<<<<<<<<<<<<<
14351  * for k in range(mt.shape[1]):
14352  * mt_avg += dV[eN,k]*mt[eN,k]
14353  */
14354  __Pyx_INCREF(__pyx_float_0_0);
14355  __Pyx_XDECREF_SET(__pyx_v_vol, __pyx_float_0_0);
14356 
14357  /* "subsurfaceTransportFunctions.pyx":685
14358  * mt_avg = 0.0
14359  * vol = 0.0
14360  * for k in range(mt.shape[1]): # <<<<<<<<<<<<<<
14361  * mt_avg += dV[eN,k]*mt[eN,k]
14362  * vol += dV[eN,k]
14363  */
14364  __pyx_t_3 = (__pyx_v_mt->dimensions[1]);
14365  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
14366  __pyx_v_k = __pyx_t_4;
14367 
14368  /* "subsurfaceTransportFunctions.pyx":686
14369  * vol = 0.0
14370  * for k in range(mt.shape[1]):
14371  * mt_avg += dV[eN,k]*mt[eN,k] # <<<<<<<<<<<<<<
14372  * vol += dV[eN,k]
14373  * mt_avg /= vol
14374  */
14375  __pyx_t_5 = __pyx_v_eN;
14376  __pyx_t_6 = __pyx_v_k;
14377  __pyx_t_7 = -1;
14378  if (__pyx_t_5 < 0) {
14379  __pyx_t_5 += __pyx_pybuffernd_dV.diminfo[0].shape;
14380  if (unlikely(__pyx_t_5 < 0)) __pyx_t_7 = 0;
14381  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_7 = 0;
14382  if (__pyx_t_6 < 0) {
14383  __pyx_t_6 += __pyx_pybuffernd_dV.diminfo[1].shape;
14384  if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 1;
14385  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_7 = 1;
14386  if (unlikely(__pyx_t_7 != -1)) {
14387  __Pyx_RaiseBufferIndexError(__pyx_t_7);
14388  __PYX_ERR(0, 686, __pyx_L1_error)
14389  }
14390  __pyx_t_8 = __pyx_v_eN;
14391  __pyx_t_9 = __pyx_v_k;
14392  __pyx_t_7 = -1;
14393  if (__pyx_t_8 < 0) {
14394  __pyx_t_8 += __pyx_pybuffernd_mt.diminfo[0].shape;
14395  if (unlikely(__pyx_t_8 < 0)) __pyx_t_7 = 0;
14396  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_mt.diminfo[0].shape)) __pyx_t_7 = 0;
14397  if (__pyx_t_9 < 0) {
14398  __pyx_t_9 += __pyx_pybuffernd_mt.diminfo[1].shape;
14399  if (unlikely(__pyx_t_9 < 0)) __pyx_t_7 = 1;
14400  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_mt.diminfo[1].shape)) __pyx_t_7 = 1;
14401  if (unlikely(__pyx_t_7 != -1)) {
14402  __Pyx_RaiseBufferIndexError(__pyx_t_7);
14403  __PYX_ERR(0, 686, __pyx_L1_error)
14404  }
14405  __pyx_t_10 = PyFloat_FromDouble(((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_dV.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_mt.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_mt.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_mt.diminfo[1].strides)))); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 686, __pyx_L1_error)
14406  __Pyx_GOTREF(__pyx_t_10);
14407  __pyx_t_11 = PyNumber_InPlaceAdd(__pyx_v_mt_avg, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 686, __pyx_L1_error)
14408  __Pyx_GOTREF(__pyx_t_11);
14409  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
14410  __Pyx_DECREF_SET(__pyx_v_mt_avg, __pyx_t_11);
14411  __pyx_t_11 = 0;
14412 
14413  /* "subsurfaceTransportFunctions.pyx":687
14414  * for k in range(mt.shape[1]):
14415  * mt_avg += dV[eN,k]*mt[eN,k]
14416  * vol += dV[eN,k] # <<<<<<<<<<<<<<
14417  * mt_avg /= vol
14418  * for i in range(weak_residual.shape[1]):
14419  */
14420  __pyx_t_12 = __pyx_v_eN;
14421  __pyx_t_13 = __pyx_v_k;
14422  __pyx_t_7 = -1;
14423  if (__pyx_t_12 < 0) {
14424  __pyx_t_12 += __pyx_pybuffernd_dV.diminfo[0].shape;
14425  if (unlikely(__pyx_t_12 < 0)) __pyx_t_7 = 0;
14426  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_7 = 0;
14427  if (__pyx_t_13 < 0) {
14428  __pyx_t_13 += __pyx_pybuffernd_dV.diminfo[1].shape;
14429  if (unlikely(__pyx_t_13 < 0)) __pyx_t_7 = 1;
14430  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_7 = 1;
14431  if (unlikely(__pyx_t_7 != -1)) {
14432  __Pyx_RaiseBufferIndexError(__pyx_t_7);
14433  __PYX_ERR(0, 687, __pyx_L1_error)
14434  }
14435  __pyx_t_11 = PyFloat_FromDouble((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_dV.diminfo[1].strides))); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 687, __pyx_L1_error)
14436  __Pyx_GOTREF(__pyx_t_11);
14437  __pyx_t_10 = PyNumber_InPlaceAdd(__pyx_v_vol, __pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 687, __pyx_L1_error)
14438  __Pyx_GOTREF(__pyx_t_10);
14439  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
14440  __Pyx_DECREF_SET(__pyx_v_vol, __pyx_t_10);
14441  __pyx_t_10 = 0;
14442  }
14443 
14444  /* "subsurfaceTransportFunctions.pyx":688
14445  * mt_avg += dV[eN,k]*mt[eN,k]
14446  * vol += dV[eN,k]
14447  * mt_avg /= vol # <<<<<<<<<<<<<<
14448  * for i in range(weak_residual.shape[1]):
14449  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
14450  */
14451  __pyx_t_10 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_mt_avg, __pyx_v_vol); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 688, __pyx_L1_error)
14452  __Pyx_GOTREF(__pyx_t_10);
14453  __Pyx_DECREF_SET(__pyx_v_mt_avg, __pyx_t_10);
14454  __pyx_t_10 = 0;
14455 
14456  /* "subsurfaceTransportFunctions.pyx":689
14457  * vol += dV[eN,k]
14458  * mt_avg /= vol
14459  * for i in range(weak_residual.shape[1]): # <<<<<<<<<<<<<<
14460  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
14461  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
14462  */
14463  __pyx_t_3 = (__pyx_v_weak_residual->dimensions[1]);
14464  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
14465  __pyx_v_i = __pyx_t_4;
14466 
14467  /* "subsurfaceTransportFunctions.pyx":691
14468  * for i in range(weak_residual.shape[1]):
14469  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
14470  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k]) # <<<<<<<<<<<<<<
14471  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt,
14472  * numpy.ndarray[DTYPE_t,ndim=3] w,
14473  */
14474  __pyx_t_14 = __pyx_v_eN;
14475  __pyx_t_15 = __pyx_v_k;
14476  __pyx_t_16 = __pyx_v_i;
14477  __pyx_t_7 = -1;
14478  if (__pyx_t_14 < 0) {
14479  __pyx_t_14 += __pyx_pybuffernd_w.diminfo[0].shape;
14480  if (unlikely(__pyx_t_14 < 0)) __pyx_t_7 = 0;
14481  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_w.diminfo[0].shape)) __pyx_t_7 = 0;
14482  if (__pyx_t_15 < 0) {
14483  __pyx_t_15 += __pyx_pybuffernd_w.diminfo[1].shape;
14484  if (unlikely(__pyx_t_15 < 0)) __pyx_t_7 = 1;
14485  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_w.diminfo[1].shape)) __pyx_t_7 = 1;
14486  if (__pyx_t_16 < 0) {
14487  __pyx_t_16 += __pyx_pybuffernd_w.diminfo[2].shape;
14488  if (unlikely(__pyx_t_16 < 0)) __pyx_t_7 = 2;
14489  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_w.diminfo[2].shape)) __pyx_t_7 = 2;
14490  if (unlikely(__pyx_t_7 != -1)) {
14491  __Pyx_RaiseBufferIndexError(__pyx_t_7);
14492  __PYX_ERR(0, 691, __pyx_L1_error)
14493  }
14494  __pyx_t_10 = PyFloat_FromDouble((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_w.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_w.diminfo[1].strides, __pyx_t_16, __pyx_pybuffernd_w.diminfo[2].strides))); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 691, __pyx_L1_error)
14495  __Pyx_GOTREF(__pyx_t_10);
14496  __pyx_t_11 = PyNumber_Multiply(__pyx_v_mt_avg, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 691, __pyx_L1_error)
14497  __Pyx_GOTREF(__pyx_t_11);
14498  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
14499  __pyx_t_17 = __pyx_v_eN;
14500  __pyx_t_18 = __pyx_v_k;
14501  __pyx_t_7 = -1;
14502  if (__pyx_t_17 < 0) {
14503  __pyx_t_17 += __pyx_pybuffernd_dV.diminfo[0].shape;
14504  if (unlikely(__pyx_t_17 < 0)) __pyx_t_7 = 0;
14505  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_7 = 0;
14506  if (__pyx_t_18 < 0) {
14507  __pyx_t_18 += __pyx_pybuffernd_dV.diminfo[1].shape;
14508  if (unlikely(__pyx_t_18 < 0)) __pyx_t_7 = 1;
14509  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_7 = 1;
14510  if (unlikely(__pyx_t_7 != -1)) {
14511  __Pyx_RaiseBufferIndexError(__pyx_t_7);
14512  __PYX_ERR(0, 691, __pyx_L1_error)
14513  }
14514  __pyx_t_10 = PyFloat_FromDouble((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_dV.diminfo[1].strides))); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 691, __pyx_L1_error)
14515  __Pyx_GOTREF(__pyx_t_10);
14516  __pyx_t_19 = PyNumber_Multiply(__pyx_t_11, __pyx_t_10); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 691, __pyx_L1_error)
14517  __Pyx_GOTREF(__pyx_t_19);
14518  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
14519  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
14520  __pyx_t_20 = __Pyx_PyObject_AsDouble(__pyx_t_19); if (unlikely(__pyx_t_20 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L1_error)
14521  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
14522  __pyx_t_21 = __pyx_v_eN;
14523  __pyx_t_22 = __pyx_v_i;
14524  __pyx_t_7 = -1;
14525  if (__pyx_t_21 < 0) {
14526  __pyx_t_21 += __pyx_pybuffernd_weak_residual.diminfo[0].shape;
14527  if (unlikely(__pyx_t_21 < 0)) __pyx_t_7 = 0;
14528  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_weak_residual.diminfo[0].shape)) __pyx_t_7 = 0;
14529  if (__pyx_t_22 < 0) {
14530  __pyx_t_22 += __pyx_pybuffernd_weak_residual.diminfo[1].shape;
14531  if (unlikely(__pyx_t_22 < 0)) __pyx_t_7 = 1;
14532  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_weak_residual.diminfo[1].shape)) __pyx_t_7 = 1;
14533  if (unlikely(__pyx_t_7 != -1)) {
14534  __Pyx_RaiseBufferIndexError(__pyx_t_7);
14535  __PYX_ERR(0, 691, __pyx_L1_error)
14536  }
14537  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_weak_residual.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_weak_residual.diminfo[1].strides) += __pyx_t_20;
14538  }
14539  }
14540 
14541  /* "subsurfaceTransportFunctions.pyx":673
14542  * ##################################################
14543  *
14544  * def updateMass_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] mt, # <<<<<<<<<<<<<<
14545  * numpy.ndarray[DTYPE_t,ndim=3] w,
14546  * numpy.ndarray[DTYPE_t,ndim=2] dV,
14547  */
14548 
14549  /* function exit code */
14550  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14551  goto __pyx_L0;
14552  __pyx_L1_error:;
14553  __Pyx_XDECREF(__pyx_t_10);
14554  __Pyx_XDECREF(__pyx_t_11);
14555  __Pyx_XDECREF(__pyx_t_19);
14556  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
14557  __Pyx_PyThreadState_declare
14558  __Pyx_PyThreadState_assign
14559  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
14560  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
14561  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mt.rcbuffer->pybuffer);
14562  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
14563  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weak_residual.rcbuffer->pybuffer);
14564  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
14565  __Pyx_AddTraceback("subsurfaceTransportFunctions.updateMass_weakAvg", __pyx_clineno, __pyx_lineno, __pyx_filename);
14566  __pyx_r = NULL;
14567  goto __pyx_L2;
14568  __pyx_L0:;
14569  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
14570  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mt.rcbuffer->pybuffer);
14571  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
14572  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weak_residual.rcbuffer->pybuffer);
14573  __pyx_L2:;
14574  __Pyx_XDECREF(__pyx_v_mt_avg);
14575  __Pyx_XDECREF(__pyx_v_vol);
14576  __Pyx_XGIVEREF(__pyx_r);
14577  __Pyx_RefNannyFinishContext();
14578  return __pyx_r;
14579 }
14580 
14581 /* "subsurfaceTransportFunctions.pyx":692
14582  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
14583  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
14584  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt, # <<<<<<<<<<<<<<
14585  * numpy.ndarray[DTYPE_t,ndim=3] w,
14586  * numpy.ndarray[DTYPE_t,ndim=3] v,
14587  */
14588 
14589 /* Python wrapper */
14590 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
14591 static char __pyx_doc_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg[] = "\n approximate element mass Jacobian term as (\\pd{\010ar{c}_e}{u_j},w_{h,i})_e\n ";
14592 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg = {"updateMassJacobian_weakAvg", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg};
14593 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
14594  PyArrayObject *__pyx_v_dmt = 0;
14595  PyArrayObject *__pyx_v_w = 0;
14596  PyArrayObject *__pyx_v_v = 0;
14597  PyArrayObject *__pyx_v_dV = 0;
14598  PyArrayObject *__pyx_v_jacobian_weak_residual = 0;
14599  PyObject *__pyx_r = 0;
14600  __Pyx_RefNannyDeclarations
14601  __Pyx_RefNannySetupContext("updateMassJacobian_weakAvg (wrapper)", 0);
14602  {
14603  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dmt,&__pyx_n_s_w,&__pyx_n_s_v,&__pyx_n_s_dV,&__pyx_n_s_jacobian_weak_residual,0};
14604  PyObject* values[5] = {0,0,0,0,0};
14605  if (unlikely(__pyx_kwds)) {
14606  Py_ssize_t kw_args;
14607  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
14608  switch (pos_args) {
14609  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
14610  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
14611  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
14612  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14613  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14614  case 0: break;
14615  default: goto __pyx_L5_argtuple_error;
14616  }
14617  kw_args = PyDict_Size(__pyx_kwds);
14618  switch (pos_args) {
14619  case 0:
14620  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dmt)) != 0)) kw_args--;
14621  else goto __pyx_L5_argtuple_error;
14622  case 1:
14623  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
14624  else {
14625  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, 1); __PYX_ERR(0, 692, __pyx_L3_error)
14626  }
14627  case 2:
14628  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
14629  else {
14630  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, 2); __PYX_ERR(0, 692, __pyx_L3_error)
14631  }
14632  case 3:
14633  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dV)) != 0)) kw_args--;
14634  else {
14635  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, 3); __PYX_ERR(0, 692, __pyx_L3_error)
14636  }
14637  case 4:
14638  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_jacobian_weak_residual)) != 0)) kw_args--;
14639  else {
14640  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, 4); __PYX_ERR(0, 692, __pyx_L3_error)
14641  }
14642  }
14643  if (unlikely(kw_args > 0)) {
14644  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateMassJacobian_weakAvg") < 0)) __PYX_ERR(0, 692, __pyx_L3_error)
14645  }
14646  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
14647  goto __pyx_L5_argtuple_error;
14648  } else {
14649  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14650  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14651  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
14652  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
14653  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
14654  }
14655  __pyx_v_dmt = ((PyArrayObject *)values[0]);
14656  __pyx_v_w = ((PyArrayObject *)values[1]);
14657  __pyx_v_v = ((PyArrayObject *)values[2]);
14658  __pyx_v_dV = ((PyArrayObject *)values[3]);
14659  __pyx_v_jacobian_weak_residual = ((PyArrayObject *)values[4]);
14660  }
14661  goto __pyx_L4_argument_unpacking_done;
14662  __pyx_L5_argtuple_error:;
14663  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 692, __pyx_L3_error)
14664  __pyx_L3_error:;
14665  __Pyx_AddTraceback("subsurfaceTransportFunctions.updateMassJacobian_weakAvg", __pyx_clineno, __pyx_lineno, __pyx_filename);
14666  __Pyx_RefNannyFinishContext();
14667  return NULL;
14668  __pyx_L4_argument_unpacking_done:;
14669  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dmt), __pyx_ptype_5numpy_ndarray, 1, "dmt", 0))) __PYX_ERR(0, 692, __pyx_L1_error)
14670  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) __PYX_ERR(0, 693, __pyx_L1_error)
14671  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 694, __pyx_L1_error)
14672  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dV), __pyx_ptype_5numpy_ndarray, 1, "dV", 0))) __PYX_ERR(0, 695, __pyx_L1_error)
14673  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_jacobian_weak_residual), __pyx_ptype_5numpy_ndarray, 1, "jacobian_weak_residual", 0))) __PYX_ERR(0, 696, __pyx_L1_error)
14674  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg(__pyx_self, __pyx_v_dmt, __pyx_v_w, __pyx_v_v, __pyx_v_dV, __pyx_v_jacobian_weak_residual);
14675 
14676  /* function exit code */
14677  goto __pyx_L0;
14678  __pyx_L1_error:;
14679  __pyx_r = NULL;
14680  __pyx_L0:;
14681  __Pyx_RefNannyFinishContext();
14682  return __pyx_r;
14683 }
14684 
14685 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_dmt, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_dV, PyArrayObject *__pyx_v_jacobian_weak_residual) {
14686  int __pyx_v_eN;
14687  int __pyx_v_i;
14688  int __pyx_v_j;
14689  int __pyx_v_k;
14690  double __pyx_v_dmtj_avg;
14691  double __pyx_v_vol;
14692  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
14693  __Pyx_Buffer __pyx_pybuffer_dV;
14694  __Pyx_LocalBuf_ND __pyx_pybuffernd_dmt;
14695  __Pyx_Buffer __pyx_pybuffer_dmt;
14696  __Pyx_LocalBuf_ND __pyx_pybuffernd_jacobian_weak_residual;
14697  __Pyx_Buffer __pyx_pybuffer_jacobian_weak_residual;
14698  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
14699  __Pyx_Buffer __pyx_pybuffer_v;
14700  __Pyx_LocalBuf_ND __pyx_pybuffernd_w;
14701  __Pyx_Buffer __pyx_pybuffer_w;
14702  PyObject *__pyx_r = NULL;
14703  __Pyx_RefNannyDeclarations
14704  npy_intp __pyx_t_1;
14705  int __pyx_t_2;
14706  npy_intp __pyx_t_3;
14707  int __pyx_t_4;
14708  Py_ssize_t __pyx_t_5;
14709  Py_ssize_t __pyx_t_6;
14710  int __pyx_t_7;
14711  npy_intp __pyx_t_8;
14712  npy_intp __pyx_t_9;
14713  int __pyx_t_10;
14714  Py_ssize_t __pyx_t_11;
14715  Py_ssize_t __pyx_t_12;
14716  int __pyx_t_13;
14717  Py_ssize_t __pyx_t_14;
14718  Py_ssize_t __pyx_t_15;
14719  Py_ssize_t __pyx_t_16;
14720  Py_ssize_t __pyx_t_17;
14721  Py_ssize_t __pyx_t_18;
14722  Py_ssize_t __pyx_t_19;
14723  Py_ssize_t __pyx_t_20;
14724  Py_ssize_t __pyx_t_21;
14725  Py_ssize_t __pyx_t_22;
14726  Py_ssize_t __pyx_t_23;
14727  Py_ssize_t __pyx_t_24;
14728  Py_ssize_t __pyx_t_25;
14729  Py_ssize_t __pyx_t_26;
14730  __Pyx_RefNannySetupContext("updateMassJacobian_weakAvg", 0);
14731  __pyx_pybuffer_dmt.pybuffer.buf = NULL;
14732  __pyx_pybuffer_dmt.refcount = 0;
14733  __pyx_pybuffernd_dmt.data = NULL;
14734  __pyx_pybuffernd_dmt.rcbuffer = &__pyx_pybuffer_dmt;
14735  __pyx_pybuffer_w.pybuffer.buf = NULL;
14736  __pyx_pybuffer_w.refcount = 0;
14737  __pyx_pybuffernd_w.data = NULL;
14738  __pyx_pybuffernd_w.rcbuffer = &__pyx_pybuffer_w;
14739  __pyx_pybuffer_v.pybuffer.buf = NULL;
14740  __pyx_pybuffer_v.refcount = 0;
14741  __pyx_pybuffernd_v.data = NULL;
14742  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
14743  __pyx_pybuffer_dV.pybuffer.buf = NULL;
14744  __pyx_pybuffer_dV.refcount = 0;
14745  __pyx_pybuffernd_dV.data = NULL;
14746  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
14747  __pyx_pybuffer_jacobian_weak_residual.pybuffer.buf = NULL;
14748  __pyx_pybuffer_jacobian_weak_residual.refcount = 0;
14749  __pyx_pybuffernd_jacobian_weak_residual.data = NULL;
14750  __pyx_pybuffernd_jacobian_weak_residual.rcbuffer = &__pyx_pybuffer_jacobian_weak_residual;
14751  {
14752  __Pyx_BufFmt_StackElem __pyx_stack[1];
14753  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dmt.rcbuffer->pybuffer, (PyObject*)__pyx_v_dmt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
14754  }
14755  __pyx_pybuffernd_dmt.diminfo[0].strides = __pyx_pybuffernd_dmt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dmt.diminfo[0].shape = __pyx_pybuffernd_dmt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dmt.diminfo[1].strides = __pyx_pybuffernd_dmt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dmt.diminfo[1].shape = __pyx_pybuffernd_dmt.rcbuffer->pybuffer.shape[1];
14756  {
14757  __Pyx_BufFmt_StackElem __pyx_stack[1];
14758  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
14759  }
14760  __pyx_pybuffernd_w.diminfo[0].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_w.diminfo[0].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_w.diminfo[1].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_w.diminfo[1].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_w.diminfo[2].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_w.diminfo[2].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[2];
14761  {
14762  __Pyx_BufFmt_StackElem __pyx_stack[1];
14763  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
14764  }
14765  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2];
14766  {
14767  __Pyx_BufFmt_StackElem __pyx_stack[1];
14768  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
14769  }
14770  __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dV.diminfo[1].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dV.diminfo[1].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[1];
14771  {
14772  __Pyx_BufFmt_StackElem __pyx_stack[1];
14773  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer, (PyObject*)__pyx_v_jacobian_weak_residual, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
14774  }
14775  __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].strides = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].shape = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].strides = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].shape = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].strides = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].shape = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.shape[2];
14776 
14777  /* "subsurfaceTransportFunctions.pyx":702
14778  * cdef int eN,i,j,k
14779  * cdef double dmtj_avg,vol
14780  * for eN in range(dmt.shape[0]): # <<<<<<<<<<<<<<
14781  * vol = 0.0 #should I save a loop?
14782  * for k in range(dmt.shape[1]):
14783  */
14784  __pyx_t_1 = (__pyx_v_dmt->dimensions[0]);
14785  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
14786  __pyx_v_eN = __pyx_t_2;
14787 
14788  /* "subsurfaceTransportFunctions.pyx":703
14789  * cdef double dmtj_avg,vol
14790  * for eN in range(dmt.shape[0]):
14791  * vol = 0.0 #should I save a loop? # <<<<<<<<<<<<<<
14792  * for k in range(dmt.shape[1]):
14793  * vol += dV[eN,k]
14794  */
14795  __pyx_v_vol = 0.0;
14796 
14797  /* "subsurfaceTransportFunctions.pyx":704
14798  * for eN in range(dmt.shape[0]):
14799  * vol = 0.0 #should I save a loop?
14800  * for k in range(dmt.shape[1]): # <<<<<<<<<<<<<<
14801  * vol += dV[eN,k]
14802  * for i in range(w.shape[2]):
14803  */
14804  __pyx_t_3 = (__pyx_v_dmt->dimensions[1]);
14805  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
14806  __pyx_v_k = __pyx_t_4;
14807 
14808  /* "subsurfaceTransportFunctions.pyx":705
14809  * vol = 0.0 #should I save a loop?
14810  * for k in range(dmt.shape[1]):
14811  * vol += dV[eN,k] # <<<<<<<<<<<<<<
14812  * for i in range(w.shape[2]):
14813  * for j in range(v.shape[2]):
14814  */
14815  __pyx_t_5 = __pyx_v_eN;
14816  __pyx_t_6 = __pyx_v_k;
14817  __pyx_t_7 = -1;
14818  if (__pyx_t_5 < 0) {
14819  __pyx_t_5 += __pyx_pybuffernd_dV.diminfo[0].shape;
14820  if (unlikely(__pyx_t_5 < 0)) __pyx_t_7 = 0;
14821  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_7 = 0;
14822  if (__pyx_t_6 < 0) {
14823  __pyx_t_6 += __pyx_pybuffernd_dV.diminfo[1].shape;
14824  if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 1;
14825  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_7 = 1;
14826  if (unlikely(__pyx_t_7 != -1)) {
14827  __Pyx_RaiseBufferIndexError(__pyx_t_7);
14828  __PYX_ERR(0, 705, __pyx_L1_error)
14829  }
14830  __pyx_v_vol = (__pyx_v_vol + (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_dV.diminfo[1].strides)));
14831  }
14832 
14833  /* "subsurfaceTransportFunctions.pyx":706
14834  * for k in range(dmt.shape[1]):
14835  * vol += dV[eN,k]
14836  * for i in range(w.shape[2]): # <<<<<<<<<<<<<<
14837  * for j in range(v.shape[2]):
14838  * dmtj_avg = 0.0
14839  */
14840  __pyx_t_3 = (__pyx_v_w->dimensions[2]);
14841  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
14842  __pyx_v_i = __pyx_t_4;
14843 
14844  /* "subsurfaceTransportFunctions.pyx":707
14845  * vol += dV[eN,k]
14846  * for i in range(w.shape[2]):
14847  * for j in range(v.shape[2]): # <<<<<<<<<<<<<<
14848  * dmtj_avg = 0.0
14849  * for k in range(dmt.shape[1]):
14850  */
14851  __pyx_t_8 = (__pyx_v_v->dimensions[2]);
14852  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_8; __pyx_t_7+=1) {
14853  __pyx_v_j = __pyx_t_7;
14854 
14855  /* "subsurfaceTransportFunctions.pyx":708
14856  * for i in range(w.shape[2]):
14857  * for j in range(v.shape[2]):
14858  * dmtj_avg = 0.0 # <<<<<<<<<<<<<<
14859  * for k in range(dmt.shape[1]):
14860  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j]
14861  */
14862  __pyx_v_dmtj_avg = 0.0;
14863 
14864  /* "subsurfaceTransportFunctions.pyx":709
14865  * for j in range(v.shape[2]):
14866  * dmtj_avg = 0.0
14867  * for k in range(dmt.shape[1]): # <<<<<<<<<<<<<<
14868  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j]
14869  * dmtj_avg /= vol
14870  */
14871  __pyx_t_9 = (__pyx_v_dmt->dimensions[1]);
14872  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
14873  __pyx_v_k = __pyx_t_10;
14874 
14875  /* "subsurfaceTransportFunctions.pyx":710
14876  * dmtj_avg = 0.0
14877  * for k in range(dmt.shape[1]):
14878  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j] # <<<<<<<<<<<<<<
14879  * dmtj_avg /= vol
14880  * jacobian_weak_residual[eN,i,j] += dmtj_avg*w[eN,k,i]*dV[eN,k]
14881  */
14882  __pyx_t_11 = __pyx_v_eN;
14883  __pyx_t_12 = __pyx_v_k;
14884  __pyx_t_13 = -1;
14885  if (__pyx_t_11 < 0) {
14886  __pyx_t_11 += __pyx_pybuffernd_dV.diminfo[0].shape;
14887  if (unlikely(__pyx_t_11 < 0)) __pyx_t_13 = 0;
14888  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_13 = 0;
14889  if (__pyx_t_12 < 0) {
14890  __pyx_t_12 += __pyx_pybuffernd_dV.diminfo[1].shape;
14891  if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 1;
14892  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_13 = 1;
14893  if (unlikely(__pyx_t_13 != -1)) {
14894  __Pyx_RaiseBufferIndexError(__pyx_t_13);
14895  __PYX_ERR(0, 710, __pyx_L1_error)
14896  }
14897  __pyx_t_14 = __pyx_v_eN;
14898  __pyx_t_15 = __pyx_v_k;
14899  __pyx_t_13 = -1;
14900  if (__pyx_t_14 < 0) {
14901  __pyx_t_14 += __pyx_pybuffernd_dmt.diminfo[0].shape;
14902  if (unlikely(__pyx_t_14 < 0)) __pyx_t_13 = 0;
14903  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_dmt.diminfo[0].shape)) __pyx_t_13 = 0;
14904  if (__pyx_t_15 < 0) {
14905  __pyx_t_15 += __pyx_pybuffernd_dmt.diminfo[1].shape;
14906  if (unlikely(__pyx_t_15 < 0)) __pyx_t_13 = 1;
14907  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_dmt.diminfo[1].shape)) __pyx_t_13 = 1;
14908  if (unlikely(__pyx_t_13 != -1)) {
14909  __Pyx_RaiseBufferIndexError(__pyx_t_13);
14910  __PYX_ERR(0, 710, __pyx_L1_error)
14911  }
14912  __pyx_t_16 = __pyx_v_eN;
14913  __pyx_t_17 = __pyx_v_k;
14914  __pyx_t_18 = __pyx_v_j;
14915  __pyx_t_13 = -1;
14916  if (__pyx_t_16 < 0) {
14917  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[0].shape;
14918  if (unlikely(__pyx_t_16 < 0)) __pyx_t_13 = 0;
14919  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_13 = 0;
14920  if (__pyx_t_17 < 0) {
14921  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[1].shape;
14922  if (unlikely(__pyx_t_17 < 0)) __pyx_t_13 = 1;
14923  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_13 = 1;
14924  if (__pyx_t_18 < 0) {
14925  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[2].shape;
14926  if (unlikely(__pyx_t_18 < 0)) __pyx_t_13 = 2;
14927  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_13 = 2;
14928  if (unlikely(__pyx_t_13 != -1)) {
14929  __Pyx_RaiseBufferIndexError(__pyx_t_13);
14930  __PYX_ERR(0, 710, __pyx_L1_error)
14931  }
14932  __pyx_v_dmtj_avg = (__pyx_v_dmtj_avg + (((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_dV.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dmt.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_dmt.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_dmt.diminfo[1].strides))) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[2].strides))));
14933  }
14934 
14935  /* "subsurfaceTransportFunctions.pyx":711
14936  * for k in range(dmt.shape[1]):
14937  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j]
14938  * dmtj_avg /= vol # <<<<<<<<<<<<<<
14939  * jacobian_weak_residual[eN,i,j] += dmtj_avg*w[eN,k,i]*dV[eN,k]
14940  *
14941  */
14942  if (unlikely(__pyx_v_vol == 0)) {
14943  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
14944  __PYX_ERR(0, 711, __pyx_L1_error)
14945  }
14946  __pyx_v_dmtj_avg = (__pyx_v_dmtj_avg / __pyx_v_vol);
14947 
14948  /* "subsurfaceTransportFunctions.pyx":712
14949  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j]
14950  * dmtj_avg /= vol
14951  * jacobian_weak_residual[eN,i,j] += dmtj_avg*w[eN,k,i]*dV[eN,k] # <<<<<<<<<<<<<<
14952  *
14953  * ########################################################################
14954  */
14955  __pyx_t_19 = __pyx_v_eN;
14956  __pyx_t_20 = __pyx_v_k;
14957  __pyx_t_21 = __pyx_v_i;
14958  __pyx_t_10 = -1;
14959  if (__pyx_t_19 < 0) {
14960  __pyx_t_19 += __pyx_pybuffernd_w.diminfo[0].shape;
14961  if (unlikely(__pyx_t_19 < 0)) __pyx_t_10 = 0;
14962  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_w.diminfo[0].shape)) __pyx_t_10 = 0;
14963  if (__pyx_t_20 < 0) {
14964  __pyx_t_20 += __pyx_pybuffernd_w.diminfo[1].shape;
14965  if (unlikely(__pyx_t_20 < 0)) __pyx_t_10 = 1;
14966  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_w.diminfo[1].shape)) __pyx_t_10 = 1;
14967  if (__pyx_t_21 < 0) {
14968  __pyx_t_21 += __pyx_pybuffernd_w.diminfo[2].shape;
14969  if (unlikely(__pyx_t_21 < 0)) __pyx_t_10 = 2;
14970  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_w.diminfo[2].shape)) __pyx_t_10 = 2;
14971  if (unlikely(__pyx_t_10 != -1)) {
14972  __Pyx_RaiseBufferIndexError(__pyx_t_10);
14973  __PYX_ERR(0, 712, __pyx_L1_error)
14974  }
14975  __pyx_t_22 = __pyx_v_eN;
14976  __pyx_t_23 = __pyx_v_k;
14977  __pyx_t_10 = -1;
14978  if (__pyx_t_22 < 0) {
14979  __pyx_t_22 += __pyx_pybuffernd_dV.diminfo[0].shape;
14980  if (unlikely(__pyx_t_22 < 0)) __pyx_t_10 = 0;
14981  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_10 = 0;
14982  if (__pyx_t_23 < 0) {
14983  __pyx_t_23 += __pyx_pybuffernd_dV.diminfo[1].shape;
14984  if (unlikely(__pyx_t_23 < 0)) __pyx_t_10 = 1;
14985  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_10 = 1;
14986  if (unlikely(__pyx_t_10 != -1)) {
14987  __Pyx_RaiseBufferIndexError(__pyx_t_10);
14988  __PYX_ERR(0, 712, __pyx_L1_error)
14989  }
14990  __pyx_t_24 = __pyx_v_eN;
14991  __pyx_t_25 = __pyx_v_i;
14992  __pyx_t_26 = __pyx_v_j;
14993  __pyx_t_10 = -1;
14994  if (__pyx_t_24 < 0) {
14995  __pyx_t_24 += __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].shape;
14996  if (unlikely(__pyx_t_24 < 0)) __pyx_t_10 = 0;
14997  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].shape)) __pyx_t_10 = 0;
14998  if (__pyx_t_25 < 0) {
14999  __pyx_t_25 += __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].shape;
15000  if (unlikely(__pyx_t_25 < 0)) __pyx_t_10 = 1;
15001  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].shape)) __pyx_t_10 = 1;
15002  if (__pyx_t_26 < 0) {
15003  __pyx_t_26 += __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].shape;
15004  if (unlikely(__pyx_t_26 < 0)) __pyx_t_10 = 2;
15005  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].shape)) __pyx_t_10 = 2;
15006  if (unlikely(__pyx_t_10 != -1)) {
15007  __Pyx_RaiseBufferIndexError(__pyx_t_10);
15008  __PYX_ERR(0, 712, __pyx_L1_error)
15009  }
15010  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].strides, __pyx_t_26, __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].strides) += ((__pyx_v_dmtj_avg * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_w.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_w.diminfo[1].strides, __pyx_t_21, __pyx_pybuffernd_w.diminfo[2].strides))) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_dV.diminfo[1].strides)));
15011  }
15012  }
15013  }
15014 
15015  /* "subsurfaceTransportFunctions.pyx":692
15016  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
15017  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
15018  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt, # <<<<<<<<<<<<<<
15019  * numpy.ndarray[DTYPE_t,ndim=3] w,
15020  * numpy.ndarray[DTYPE_t,ndim=3] v,
15021  */
15022 
15023  /* function exit code */
15024  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15025  goto __pyx_L0;
15026  __pyx_L1_error:;
15027  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
15028  __Pyx_PyThreadState_declare
15029  __Pyx_PyThreadState_assign
15030  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
15031  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
15032  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dmt.rcbuffer->pybuffer);
15033  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer);
15034  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
15035  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
15036  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
15037  __Pyx_AddTraceback("subsurfaceTransportFunctions.updateMassJacobian_weakAvg", __pyx_clineno, __pyx_lineno, __pyx_filename);
15038  __pyx_r = NULL;
15039  goto __pyx_L2;
15040  __pyx_L0:;
15041  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
15042  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dmt.rcbuffer->pybuffer);
15043  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer);
15044  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
15045  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
15046  __pyx_L2:;
15047  __Pyx_XGIVEREF(__pyx_r);
15048  __Pyx_RefNannyFinishContext();
15049  return __pyx_r;
15050 }
15051 
15052 /* "subsurfaceTransportFunctions.pyx":717
15053  * #ELLAM
15054  * ########################################################################
15055  * def calculateNormalFlux(numpy.ndarray[DTYPE_t,ndim=4] v, # <<<<<<<<<<<<<<
15056  * numpy.ndarray[DTYPE_t,ndim=4] n,
15057  * numpy.ndarray[DTYPE_t,ndim=3] dS,
15058  */
15059 
15060 /* Python wrapper */
15061 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_41calculateNormalFlux(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
15062 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_41calculateNormalFlux = {"calculateNormalFlux", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_41calculateNormalFlux, METH_VARARGS|METH_KEYWORDS, 0};
15063 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_41calculateNormalFlux(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15064  PyArrayObject *__pyx_v_v = 0;
15065  PyArrayObject *__pyx_v_n = 0;
15066  PyArrayObject *__pyx_v_dS = 0;
15067  PyArrayObject *__pyx_v_flux = 0;
15068  PyObject *__pyx_r = 0;
15069  __Pyx_RefNannyDeclarations
15070  __Pyx_RefNannySetupContext("calculateNormalFlux (wrapper)", 0);
15071  {
15072  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,&__pyx_n_s_n,&__pyx_n_s_dS,&__pyx_n_s_flux,0};
15073  PyObject* values[4] = {0,0,0,0};
15074  if (unlikely(__pyx_kwds)) {
15075  Py_ssize_t kw_args;
15076  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
15077  switch (pos_args) {
15078  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15079  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15080  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15081  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15082  case 0: break;
15083  default: goto __pyx_L5_argtuple_error;
15084  }
15085  kw_args = PyDict_Size(__pyx_kwds);
15086  switch (pos_args) {
15087  case 0:
15088  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
15089  else goto __pyx_L5_argtuple_error;
15090  case 1:
15091  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
15092  else {
15093  __Pyx_RaiseArgtupleInvalid("calculateNormalFlux", 1, 4, 4, 1); __PYX_ERR(0, 717, __pyx_L3_error)
15094  }
15095  case 2:
15096  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dS)) != 0)) kw_args--;
15097  else {
15098  __Pyx_RaiseArgtupleInvalid("calculateNormalFlux", 1, 4, 4, 2); __PYX_ERR(0, 717, __pyx_L3_error)
15099  }
15100  case 3:
15101  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_flux)) != 0)) kw_args--;
15102  else {
15103  __Pyx_RaiseArgtupleInvalid("calculateNormalFlux", 1, 4, 4, 3); __PYX_ERR(0, 717, __pyx_L3_error)
15104  }
15105  }
15106  if (unlikely(kw_args > 0)) {
15107  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calculateNormalFlux") < 0)) __PYX_ERR(0, 717, __pyx_L3_error)
15108  }
15109  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
15110  goto __pyx_L5_argtuple_error;
15111  } else {
15112  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15113  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15114  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15115  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15116  }
15117  __pyx_v_v = ((PyArrayObject *)values[0]);
15118  __pyx_v_n = ((PyArrayObject *)values[1]);
15119  __pyx_v_dS = ((PyArrayObject *)values[2]);
15120  __pyx_v_flux = ((PyArrayObject *)values[3]);
15121  }
15122  goto __pyx_L4_argument_unpacking_done;
15123  __pyx_L5_argtuple_error:;
15124  __Pyx_RaiseArgtupleInvalid("calculateNormalFlux", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 717, __pyx_L3_error)
15125  __pyx_L3_error:;
15126  __Pyx_AddTraceback("subsurfaceTransportFunctions.calculateNormalFlux", __pyx_clineno, __pyx_lineno, __pyx_filename);
15127  __Pyx_RefNannyFinishContext();
15128  return NULL;
15129  __pyx_L4_argument_unpacking_done:;
15130  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 717, __pyx_L1_error)
15131  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_n), __pyx_ptype_5numpy_ndarray, 1, "n", 0))) __PYX_ERR(0, 718, __pyx_L1_error)
15132  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dS), __pyx_ptype_5numpy_ndarray, 1, "dS", 0))) __PYX_ERR(0, 719, __pyx_L1_error)
15133  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_flux), __pyx_ptype_5numpy_ndarray, 1, "flux", 0))) __PYX_ERR(0, 720, __pyx_L1_error)
15134  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_40calculateNormalFlux(__pyx_self, __pyx_v_v, __pyx_v_n, __pyx_v_dS, __pyx_v_flux);
15135 
15136  /* function exit code */
15137  goto __pyx_L0;
15138  __pyx_L1_error:;
15139  __pyx_r = NULL;
15140  __pyx_L0:;
15141  __Pyx_RefNannyFinishContext();
15142  return __pyx_r;
15143 }
15144 
15145 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_40calculateNormalFlux(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_n, PyArrayObject *__pyx_v_dS, PyArrayObject *__pyx_v_flux) {
15146  int __pyx_v_eN;
15147  int __pyx_v_ebN;
15148  int __pyx_v_kb;
15149  double __pyx_v_integral;
15150  npy_intp __pyx_v_I;
15151  __Pyx_LocalBuf_ND __pyx_pybuffernd_dS;
15152  __Pyx_Buffer __pyx_pybuffer_dS;
15153  __Pyx_LocalBuf_ND __pyx_pybuffernd_flux;
15154  __Pyx_Buffer __pyx_pybuffer_flux;
15155  __Pyx_LocalBuf_ND __pyx_pybuffernd_n;
15156  __Pyx_Buffer __pyx_pybuffer_n;
15157  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
15158  __Pyx_Buffer __pyx_pybuffer_v;
15159  PyObject *__pyx_r = NULL;
15160  __Pyx_RefNannyDeclarations
15161  npy_intp __pyx_t_1;
15162  int __pyx_t_2;
15163  npy_intp __pyx_t_3;
15164  int __pyx_t_4;
15165  npy_intp __pyx_t_5;
15166  int __pyx_t_6;
15167  npy_intp __pyx_t_7;
15168  npy_intp __pyx_t_8;
15169  Py_ssize_t __pyx_t_9;
15170  Py_ssize_t __pyx_t_10;
15171  Py_ssize_t __pyx_t_11;
15172  Py_ssize_t __pyx_t_12;
15173  int __pyx_t_13;
15174  Py_ssize_t __pyx_t_14;
15175  Py_ssize_t __pyx_t_15;
15176  Py_ssize_t __pyx_t_16;
15177  Py_ssize_t __pyx_t_17;
15178  Py_ssize_t __pyx_t_18;
15179  Py_ssize_t __pyx_t_19;
15180  Py_ssize_t __pyx_t_20;
15181  Py_ssize_t __pyx_t_21;
15182  Py_ssize_t __pyx_t_22;
15183  __Pyx_RefNannySetupContext("calculateNormalFlux", 0);
15184  __pyx_pybuffer_v.pybuffer.buf = NULL;
15185  __pyx_pybuffer_v.refcount = 0;
15186  __pyx_pybuffernd_v.data = NULL;
15187  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
15188  __pyx_pybuffer_n.pybuffer.buf = NULL;
15189  __pyx_pybuffer_n.refcount = 0;
15190  __pyx_pybuffernd_n.data = NULL;
15191  __pyx_pybuffernd_n.rcbuffer = &__pyx_pybuffer_n;
15192  __pyx_pybuffer_dS.pybuffer.buf = NULL;
15193  __pyx_pybuffer_dS.refcount = 0;
15194  __pyx_pybuffernd_dS.data = NULL;
15195  __pyx_pybuffernd_dS.rcbuffer = &__pyx_pybuffer_dS;
15196  __pyx_pybuffer_flux.pybuffer.buf = NULL;
15197  __pyx_pybuffer_flux.refcount = 0;
15198  __pyx_pybuffernd_flux.data = NULL;
15199  __pyx_pybuffernd_flux.rcbuffer = &__pyx_pybuffer_flux;
15200  {
15201  __Pyx_BufFmt_StackElem __pyx_stack[1];
15202  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 717, __pyx_L1_error)
15203  }
15204  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_v.diminfo[3].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_v.diminfo[3].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[3];
15205  {
15206  __Pyx_BufFmt_StackElem __pyx_stack[1];
15207  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_n, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 717, __pyx_L1_error)
15208  }
15209  __pyx_pybuffernd_n.diminfo[0].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_n.diminfo[0].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_n.diminfo[1].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_n.diminfo[1].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_n.diminfo[2].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_n.diminfo[2].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_n.diminfo[3].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_n.diminfo[3].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[3];
15210  {
15211  __Pyx_BufFmt_StackElem __pyx_stack[1];
15212  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_v_dS, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 717, __pyx_L1_error)
15213  }
15214  __pyx_pybuffernd_dS.diminfo[0].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dS.diminfo[0].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dS.diminfo[1].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dS.diminfo[1].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_dS.diminfo[2].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_dS.diminfo[2].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[2];
15215  {
15216  __Pyx_BufFmt_StackElem __pyx_stack[1];
15217  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_flux.rcbuffer->pybuffer, (PyObject*)__pyx_v_flux, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 717, __pyx_L1_error)
15218  }
15219  __pyx_pybuffernd_flux.diminfo[0].strides = __pyx_pybuffernd_flux.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_flux.diminfo[0].shape = __pyx_pybuffernd_flux.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_flux.diminfo[1].strides = __pyx_pybuffernd_flux.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_flux.diminfo[1].shape = __pyx_pybuffernd_flux.rcbuffer->pybuffer.shape[1];
15220 
15221  /* "subsurfaceTransportFunctions.pyx":724
15222  * cdef int eN,ebN,kb
15223  * cdef double integral
15224  * for eN in range(n.shape[0]): # <<<<<<<<<<<<<<
15225  * for ebN in range(n.shape[1]):
15226  * integral = 0.0
15227  */
15228  __pyx_t_1 = (__pyx_v_n->dimensions[0]);
15229  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
15230  __pyx_v_eN = __pyx_t_2;
15231 
15232  /* "subsurfaceTransportFunctions.pyx":725
15233  * cdef double integral
15234  * for eN in range(n.shape[0]):
15235  * for ebN in range(n.shape[1]): # <<<<<<<<<<<<<<
15236  * integral = 0.0
15237  * for kb in range(n.shape[2]):
15238  */
15239  __pyx_t_3 = (__pyx_v_n->dimensions[1]);
15240  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
15241  __pyx_v_ebN = __pyx_t_4;
15242 
15243  /* "subsurfaceTransportFunctions.pyx":726
15244  * for eN in range(n.shape[0]):
15245  * for ebN in range(n.shape[1]):
15246  * integral = 0.0 # <<<<<<<<<<<<<<
15247  * for kb in range(n.shape[2]):
15248  * for I in range(n.shape[3]):
15249  */
15250  __pyx_v_integral = 0.0;
15251 
15252  /* "subsurfaceTransportFunctions.pyx":727
15253  * for ebN in range(n.shape[1]):
15254  * integral = 0.0
15255  * for kb in range(n.shape[2]): # <<<<<<<<<<<<<<
15256  * for I in range(n.shape[3]):
15257  * integral += v[eN,ebN,kb,I]*n[eN,ebN,kb,I]*dS[eN,ebN,kb]
15258  */
15259  __pyx_t_5 = (__pyx_v_n->dimensions[2]);
15260  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
15261  __pyx_v_kb = __pyx_t_6;
15262 
15263  /* "subsurfaceTransportFunctions.pyx":728
15264  * integral = 0.0
15265  * for kb in range(n.shape[2]):
15266  * for I in range(n.shape[3]): # <<<<<<<<<<<<<<
15267  * integral += v[eN,ebN,kb,I]*n[eN,ebN,kb,I]*dS[eN,ebN,kb]
15268  * flux[eN,ebN] = integral
15269  */
15270  __pyx_t_7 = (__pyx_v_n->dimensions[3]);
15271  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
15272  __pyx_v_I = __pyx_t_8;
15273 
15274  /* "subsurfaceTransportFunctions.pyx":729
15275  * for kb in range(n.shape[2]):
15276  * for I in range(n.shape[3]):
15277  * integral += v[eN,ebN,kb,I]*n[eN,ebN,kb,I]*dS[eN,ebN,kb] # <<<<<<<<<<<<<<
15278  * flux[eN,ebN] = integral
15279  *
15280  */
15281  __pyx_t_9 = __pyx_v_eN;
15282  __pyx_t_10 = __pyx_v_ebN;
15283  __pyx_t_11 = __pyx_v_kb;
15284  __pyx_t_12 = __pyx_v_I;
15285  __pyx_t_13 = -1;
15286  if (__pyx_t_9 < 0) {
15287  __pyx_t_9 += __pyx_pybuffernd_v.diminfo[0].shape;
15288  if (unlikely(__pyx_t_9 < 0)) __pyx_t_13 = 0;
15289  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_13 = 0;
15290  if (__pyx_t_10 < 0) {
15291  __pyx_t_10 += __pyx_pybuffernd_v.diminfo[1].shape;
15292  if (unlikely(__pyx_t_10 < 0)) __pyx_t_13 = 1;
15293  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_13 = 1;
15294  if (__pyx_t_11 < 0) {
15295  __pyx_t_11 += __pyx_pybuffernd_v.diminfo[2].shape;
15296  if (unlikely(__pyx_t_11 < 0)) __pyx_t_13 = 2;
15297  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_13 = 2;
15298  if (__pyx_t_12 < 0) {
15299  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[3].shape;
15300  if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 3;
15301  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_13 = 3;
15302  if (unlikely(__pyx_t_13 != -1)) {
15303  __Pyx_RaiseBufferIndexError(__pyx_t_13);
15304  __PYX_ERR(0, 729, __pyx_L1_error)
15305  }
15306  __pyx_t_14 = __pyx_v_eN;
15307  __pyx_t_15 = __pyx_v_ebN;
15308  __pyx_t_16 = __pyx_v_kb;
15309  __pyx_t_17 = __pyx_v_I;
15310  __pyx_t_13 = -1;
15311  if (__pyx_t_14 < 0) {
15312  __pyx_t_14 += __pyx_pybuffernd_n.diminfo[0].shape;
15313  if (unlikely(__pyx_t_14 < 0)) __pyx_t_13 = 0;
15314  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_13 = 0;
15315  if (__pyx_t_15 < 0) {
15316  __pyx_t_15 += __pyx_pybuffernd_n.diminfo[1].shape;
15317  if (unlikely(__pyx_t_15 < 0)) __pyx_t_13 = 1;
15318  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_n.diminfo[1].shape)) __pyx_t_13 = 1;
15319  if (__pyx_t_16 < 0) {
15320  __pyx_t_16 += __pyx_pybuffernd_n.diminfo[2].shape;
15321  if (unlikely(__pyx_t_16 < 0)) __pyx_t_13 = 2;
15322  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_n.diminfo[2].shape)) __pyx_t_13 = 2;
15323  if (__pyx_t_17 < 0) {
15324  __pyx_t_17 += __pyx_pybuffernd_n.diminfo[3].shape;
15325  if (unlikely(__pyx_t_17 < 0)) __pyx_t_13 = 3;
15326  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_n.diminfo[3].shape)) __pyx_t_13 = 3;
15327  if (unlikely(__pyx_t_13 != -1)) {
15328  __Pyx_RaiseBufferIndexError(__pyx_t_13);
15329  __PYX_ERR(0, 729, __pyx_L1_error)
15330  }
15331  __pyx_t_18 = __pyx_v_eN;
15332  __pyx_t_19 = __pyx_v_ebN;
15333  __pyx_t_20 = __pyx_v_kb;
15334  __pyx_t_13 = -1;
15335  if (__pyx_t_18 < 0) {
15336  __pyx_t_18 += __pyx_pybuffernd_dS.diminfo[0].shape;
15337  if (unlikely(__pyx_t_18 < 0)) __pyx_t_13 = 0;
15338  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_dS.diminfo[0].shape)) __pyx_t_13 = 0;
15339  if (__pyx_t_19 < 0) {
15340  __pyx_t_19 += __pyx_pybuffernd_dS.diminfo[1].shape;
15341  if (unlikely(__pyx_t_19 < 0)) __pyx_t_13 = 1;
15342  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_dS.diminfo[1].shape)) __pyx_t_13 = 1;
15343  if (__pyx_t_20 < 0) {
15344  __pyx_t_20 += __pyx_pybuffernd_dS.diminfo[2].shape;
15345  if (unlikely(__pyx_t_20 < 0)) __pyx_t_13 = 2;
15346  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_dS.diminfo[2].shape)) __pyx_t_13 = 2;
15347  if (unlikely(__pyx_t_13 != -1)) {
15348  __Pyx_RaiseBufferIndexError(__pyx_t_13);
15349  __PYX_ERR(0, 729, __pyx_L1_error)
15350  }
15351  __pyx_v_integral = (__pyx_v_integral + (((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_11, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[3].strides)) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_n.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_n.diminfo[1].strides, __pyx_t_16, __pyx_pybuffernd_n.diminfo[2].strides, __pyx_t_17, __pyx_pybuffernd_n.diminfo[3].strides))) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dS.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_dS.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_dS.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_dS.diminfo[2].strides))));
15352  }
15353  }
15354 
15355  /* "subsurfaceTransportFunctions.pyx":730
15356  * for I in range(n.shape[3]):
15357  * integral += v[eN,ebN,kb,I]*n[eN,ebN,kb,I]*dS[eN,ebN,kb]
15358  * flux[eN,ebN] = integral # <<<<<<<<<<<<<<
15359  *
15360  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df,
15361  */
15362  __pyx_t_21 = __pyx_v_eN;
15363  __pyx_t_22 = __pyx_v_ebN;
15364  __pyx_t_6 = -1;
15365  if (__pyx_t_21 < 0) {
15366  __pyx_t_21 += __pyx_pybuffernd_flux.diminfo[0].shape;
15367  if (unlikely(__pyx_t_21 < 0)) __pyx_t_6 = 0;
15368  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_flux.diminfo[0].shape)) __pyx_t_6 = 0;
15369  if (__pyx_t_22 < 0) {
15370  __pyx_t_22 += __pyx_pybuffernd_flux.diminfo[1].shape;
15371  if (unlikely(__pyx_t_22 < 0)) __pyx_t_6 = 1;
15372  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_flux.diminfo[1].shape)) __pyx_t_6 = 1;
15373  if (unlikely(__pyx_t_6 != -1)) {
15374  __Pyx_RaiseBufferIndexError(__pyx_t_6);
15375  __PYX_ERR(0, 730, __pyx_L1_error)
15376  }
15377  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_flux.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_flux.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_flux.diminfo[1].strides) = __pyx_v_integral;
15378  }
15379  }
15380 
15381  /* "subsurfaceTransportFunctions.pyx":717
15382  * #ELLAM
15383  * ########################################################################
15384  * def calculateNormalFlux(numpy.ndarray[DTYPE_t,ndim=4] v, # <<<<<<<<<<<<<<
15385  * numpy.ndarray[DTYPE_t,ndim=4] n,
15386  * numpy.ndarray[DTYPE_t,ndim=3] dS,
15387  */
15388 
15389  /* function exit code */
15390  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15391  goto __pyx_L0;
15392  __pyx_L1_error:;
15393  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
15394  __Pyx_PyThreadState_declare
15395  __Pyx_PyThreadState_assign
15396  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
15397  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
15398  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_flux.rcbuffer->pybuffer);
15399  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer);
15400  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
15401  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
15402  __Pyx_AddTraceback("subsurfaceTransportFunctions.calculateNormalFlux", __pyx_clineno, __pyx_lineno, __pyx_filename);
15403  __pyx_r = NULL;
15404  goto __pyx_L2;
15405  __pyx_L0:;
15406  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
15407  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_flux.rcbuffer->pybuffer);
15408  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer);
15409  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
15410  __pyx_L2:;
15411  __Pyx_XGIVEREF(__pyx_r);
15412  __Pyx_RefNannyFinishContext();
15413  return __pyx_r;
15414 }
15415 
15416 /* "subsurfaceTransportFunctions.pyx":732
15417  * flux[eN,ebN] = integral
15418  *
15419  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df, # <<<<<<<<<<<<<<
15420  * numpy.ndarray[DTYPE_t,ndim=3] characteristic_velocity,
15421  * numpy.ndarray[DTYPE_t,ndim=2] dm,
15422  */
15423 
15424 /* Python wrapper */
15425 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
15426 static char __pyx_doc_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity[] = "\n simple approximation for \\lambda = df/\010ar{dm} using \010ar{dm} = \014rac{1}{\\Omega_e} \\int_{\\Omega_e} dm dV\n ";
15427 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity = {"computeSimpleCharacteristicVelocityFromElementVelocity", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity};
15428 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15429  PyArrayObject *__pyx_v_df = 0;
15430  PyArrayObject *__pyx_v_characteristic_velocity = 0;
15431  PyArrayObject *__pyx_v_dm = 0;
15432  PyArrayObject *__pyx_v_dV = 0;
15433  PyObject *__pyx_r = 0;
15434  __Pyx_RefNannyDeclarations
15435  __Pyx_RefNannySetupContext("computeSimpleCharacteristicVelocityFromElementVelocity (wrapper)", 0);
15436  {
15437  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_df,&__pyx_n_s_characteristic_velocity,&__pyx_n_s_dm,&__pyx_n_s_dV,0};
15438  PyObject* values[4] = {0,0,0,0};
15439  if (unlikely(__pyx_kwds)) {
15440  Py_ssize_t kw_args;
15441  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
15442  switch (pos_args) {
15443  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15444  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15445  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15446  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15447  case 0: break;
15448  default: goto __pyx_L5_argtuple_error;
15449  }
15450  kw_args = PyDict_Size(__pyx_kwds);
15451  switch (pos_args) {
15452  case 0:
15453  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_df)) != 0)) kw_args--;
15454  else goto __pyx_L5_argtuple_error;
15455  case 1:
15456  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_characteristic_velocity)) != 0)) kw_args--;
15457  else {
15458  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromElementVelocity", 1, 4, 4, 1); __PYX_ERR(0, 732, __pyx_L3_error)
15459  }
15460  case 2:
15461  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dm)) != 0)) kw_args--;
15462  else {
15463  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromElementVelocity", 1, 4, 4, 2); __PYX_ERR(0, 732, __pyx_L3_error)
15464  }
15465  case 3:
15466  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dV)) != 0)) kw_args--;
15467  else {
15468  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromElementVelocity", 1, 4, 4, 3); __PYX_ERR(0, 732, __pyx_L3_error)
15469  }
15470  }
15471  if (unlikely(kw_args > 0)) {
15472  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeSimpleCharacteristicVelocityFromElementVelocity") < 0)) __PYX_ERR(0, 732, __pyx_L3_error)
15473  }
15474  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
15475  goto __pyx_L5_argtuple_error;
15476  } else {
15477  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15478  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15479  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15480  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15481  }
15482  __pyx_v_df = ((PyArrayObject *)values[0]);
15483  __pyx_v_characteristic_velocity = ((PyArrayObject *)values[1]);
15484  __pyx_v_dm = ((PyArrayObject *)values[2]);
15485  __pyx_v_dV = ((PyArrayObject *)values[3]);
15486  }
15487  goto __pyx_L4_argument_unpacking_done;
15488  __pyx_L5_argtuple_error:;
15489  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromElementVelocity", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 732, __pyx_L3_error)
15490  __pyx_L3_error:;
15491  __Pyx_AddTraceback("subsurfaceTransportFunctions.computeSimpleCharacteristicVelocityFromElementVelocity", __pyx_clineno, __pyx_lineno, __pyx_filename);
15492  __Pyx_RefNannyFinishContext();
15493  return NULL;
15494  __pyx_L4_argument_unpacking_done:;
15495  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_df), __pyx_ptype_5numpy_ndarray, 1, "df", 0))) __PYX_ERR(0, 732, __pyx_L1_error)
15496  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_characteristic_velocity), __pyx_ptype_5numpy_ndarray, 1, "characteristic_velocity", 0))) __PYX_ERR(0, 733, __pyx_L1_error)
15497  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dm), __pyx_ptype_5numpy_ndarray, 1, "dm", 0))) __PYX_ERR(0, 734, __pyx_L1_error)
15498  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dV), __pyx_ptype_5numpy_ndarray, 1, "dV", 0))) __PYX_ERR(0, 735, __pyx_L1_error)
15499  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity(__pyx_self, __pyx_v_df, __pyx_v_characteristic_velocity, __pyx_v_dm, __pyx_v_dV);
15500 
15501  /* function exit code */
15502  goto __pyx_L0;
15503  __pyx_L1_error:;
15504  __pyx_r = NULL;
15505  __pyx_L0:;
15506  __Pyx_RefNannyFinishContext();
15507  return __pyx_r;
15508 }
15509 
15510 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_df, PyArrayObject *__pyx_v_characteristic_velocity, PyArrayObject *__pyx_v_dm, PyArrayObject *__pyx_v_dV) {
15511  int __pyx_v_eN;
15512  int __pyx_v_k;
15513  int __pyx_v_I;
15514  double __pyx_v_omega_e;
15515  double __pyx_v_vol_e;
15516  __Pyx_LocalBuf_ND __pyx_pybuffernd_characteristic_velocity;
15517  __Pyx_Buffer __pyx_pybuffer_characteristic_velocity;
15518  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
15519  __Pyx_Buffer __pyx_pybuffer_dV;
15520  __Pyx_LocalBuf_ND __pyx_pybuffernd_df;
15521  __Pyx_Buffer __pyx_pybuffer_df;
15522  __Pyx_LocalBuf_ND __pyx_pybuffernd_dm;
15523  __Pyx_Buffer __pyx_pybuffer_dm;
15524  PyObject *__pyx_r = NULL;
15525  __Pyx_RefNannyDeclarations
15526  npy_intp __pyx_t_1;
15527  int __pyx_t_2;
15528  npy_intp __pyx_t_3;
15529  int __pyx_t_4;
15530  Py_ssize_t __pyx_t_5;
15531  Py_ssize_t __pyx_t_6;
15532  int __pyx_t_7;
15533  Py_ssize_t __pyx_t_8;
15534  Py_ssize_t __pyx_t_9;
15535  Py_ssize_t __pyx_t_10;
15536  Py_ssize_t __pyx_t_11;
15537  npy_intp __pyx_t_12;
15538  Py_ssize_t __pyx_t_13;
15539  Py_ssize_t __pyx_t_14;
15540  Py_ssize_t __pyx_t_15;
15541  int __pyx_t_16;
15542  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_17;
15543  double __pyx_t_18;
15544  Py_ssize_t __pyx_t_19;
15545  Py_ssize_t __pyx_t_20;
15546  Py_ssize_t __pyx_t_21;
15547  __Pyx_RefNannySetupContext("computeSimpleCharacteristicVelocityFromElementVelocity", 0);
15548  __pyx_pybuffer_df.pybuffer.buf = NULL;
15549  __pyx_pybuffer_df.refcount = 0;
15550  __pyx_pybuffernd_df.data = NULL;
15551  __pyx_pybuffernd_df.rcbuffer = &__pyx_pybuffer_df;
15552  __pyx_pybuffer_characteristic_velocity.pybuffer.buf = NULL;
15553  __pyx_pybuffer_characteristic_velocity.refcount = 0;
15554  __pyx_pybuffernd_characteristic_velocity.data = NULL;
15555  __pyx_pybuffernd_characteristic_velocity.rcbuffer = &__pyx_pybuffer_characteristic_velocity;
15556  __pyx_pybuffer_dm.pybuffer.buf = NULL;
15557  __pyx_pybuffer_dm.refcount = 0;
15558  __pyx_pybuffernd_dm.data = NULL;
15559  __pyx_pybuffernd_dm.rcbuffer = &__pyx_pybuffer_dm;
15560  __pyx_pybuffer_dV.pybuffer.buf = NULL;
15561  __pyx_pybuffer_dV.refcount = 0;
15562  __pyx_pybuffernd_dV.data = NULL;
15563  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
15564  {
15565  __Pyx_BufFmt_StackElem __pyx_stack[1];
15566  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_df.rcbuffer->pybuffer, (PyObject*)__pyx_v_df, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 732, __pyx_L1_error)
15567  }
15568  __pyx_pybuffernd_df.diminfo[0].strides = __pyx_pybuffernd_df.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_df.diminfo[0].shape = __pyx_pybuffernd_df.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_df.diminfo[1].strides = __pyx_pybuffernd_df.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_df.diminfo[1].shape = __pyx_pybuffernd_df.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_df.diminfo[2].strides = __pyx_pybuffernd_df.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_df.diminfo[2].shape = __pyx_pybuffernd_df.rcbuffer->pybuffer.shape[2];
15569  {
15570  __Pyx_BufFmt_StackElem __pyx_stack[1];
15571  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer, (PyObject*)__pyx_v_characteristic_velocity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 732, __pyx_L1_error)
15572  }
15573  __pyx_pybuffernd_characteristic_velocity.diminfo[0].strides = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_characteristic_velocity.diminfo[0].shape = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_characteristic_velocity.diminfo[1].strides = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_characteristic_velocity.diminfo[1].shape = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_characteristic_velocity.diminfo[2].strides = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_characteristic_velocity.diminfo[2].shape = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.shape[2];
15574  {
15575  __Pyx_BufFmt_StackElem __pyx_stack[1];
15576  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dm.rcbuffer->pybuffer, (PyObject*)__pyx_v_dm, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 732, __pyx_L1_error)
15577  }
15578  __pyx_pybuffernd_dm.diminfo[0].strides = __pyx_pybuffernd_dm.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dm.diminfo[0].shape = __pyx_pybuffernd_dm.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dm.diminfo[1].strides = __pyx_pybuffernd_dm.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dm.diminfo[1].shape = __pyx_pybuffernd_dm.rcbuffer->pybuffer.shape[1];
15579  {
15580  __Pyx_BufFmt_StackElem __pyx_stack[1];
15581  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 732, __pyx_L1_error)
15582  }
15583  __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dV.diminfo[1].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dV.diminfo[1].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[1];
15584 
15585  /* "subsurfaceTransportFunctions.pyx":743
15586  * cdef double omega_e, vol_e
15587  *
15588  * for eN in range(dm.shape[0]): # <<<<<<<<<<<<<<
15589  * omega_e = 0.0
15590  * vol_e = 0.0
15591  */
15592  __pyx_t_1 = (__pyx_v_dm->dimensions[0]);
15593  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
15594  __pyx_v_eN = __pyx_t_2;
15595 
15596  /* "subsurfaceTransportFunctions.pyx":744
15597  *
15598  * for eN in range(dm.shape[0]):
15599  * omega_e = 0.0 # <<<<<<<<<<<<<<
15600  * vol_e = 0.0
15601  * for k in range(dm.shape[1]):
15602  */
15603  __pyx_v_omega_e = 0.0;
15604 
15605  /* "subsurfaceTransportFunctions.pyx":745
15606  * for eN in range(dm.shape[0]):
15607  * omega_e = 0.0
15608  * vol_e = 0.0 # <<<<<<<<<<<<<<
15609  * for k in range(dm.shape[1]):
15610  * vol_e += dV[eN,k]
15611  */
15612  __pyx_v_vol_e = 0.0;
15613 
15614  /* "subsurfaceTransportFunctions.pyx":746
15615  * omega_e = 0.0
15616  * vol_e = 0.0
15617  * for k in range(dm.shape[1]): # <<<<<<<<<<<<<<
15618  * vol_e += dV[eN,k]
15619  * omega_e += dV[eN,k]*dm[eN,k]
15620  */
15621  __pyx_t_3 = (__pyx_v_dm->dimensions[1]);
15622  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
15623  __pyx_v_k = __pyx_t_4;
15624 
15625  /* "subsurfaceTransportFunctions.pyx":747
15626  * vol_e = 0.0
15627  * for k in range(dm.shape[1]):
15628  * vol_e += dV[eN,k] # <<<<<<<<<<<<<<
15629  * omega_e += dV[eN,k]*dm[eN,k]
15630  * for k in range(df.shape[1]):
15631  */
15632  __pyx_t_5 = __pyx_v_eN;
15633  __pyx_t_6 = __pyx_v_k;
15634  __pyx_t_7 = -1;
15635  if (__pyx_t_5 < 0) {
15636  __pyx_t_5 += __pyx_pybuffernd_dV.diminfo[0].shape;
15637  if (unlikely(__pyx_t_5 < 0)) __pyx_t_7 = 0;
15638  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_7 = 0;
15639  if (__pyx_t_6 < 0) {
15640  __pyx_t_6 += __pyx_pybuffernd_dV.diminfo[1].shape;
15641  if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 1;
15642  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_7 = 1;
15643  if (unlikely(__pyx_t_7 != -1)) {
15644  __Pyx_RaiseBufferIndexError(__pyx_t_7);
15645  __PYX_ERR(0, 747, __pyx_L1_error)
15646  }
15647  __pyx_v_vol_e = (__pyx_v_vol_e + (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_dV.diminfo[1].strides)));
15648 
15649  /* "subsurfaceTransportFunctions.pyx":748
15650  * for k in range(dm.shape[1]):
15651  * vol_e += dV[eN,k]
15652  * omega_e += dV[eN,k]*dm[eN,k] # <<<<<<<<<<<<<<
15653  * for k in range(df.shape[1]):
15654  * for I in range(df.shape[2]):
15655  */
15656  __pyx_t_8 = __pyx_v_eN;
15657  __pyx_t_9 = __pyx_v_k;
15658  __pyx_t_7 = -1;
15659  if (__pyx_t_8 < 0) {
15660  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[0].shape;
15661  if (unlikely(__pyx_t_8 < 0)) __pyx_t_7 = 0;
15662  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_7 = 0;
15663  if (__pyx_t_9 < 0) {
15664  __pyx_t_9 += __pyx_pybuffernd_dV.diminfo[1].shape;
15665  if (unlikely(__pyx_t_9 < 0)) __pyx_t_7 = 1;
15666  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_7 = 1;
15667  if (unlikely(__pyx_t_7 != -1)) {
15668  __Pyx_RaiseBufferIndexError(__pyx_t_7);
15669  __PYX_ERR(0, 748, __pyx_L1_error)
15670  }
15671  __pyx_t_10 = __pyx_v_eN;
15672  __pyx_t_11 = __pyx_v_k;
15673  __pyx_t_7 = -1;
15674  if (__pyx_t_10 < 0) {
15675  __pyx_t_10 += __pyx_pybuffernd_dm.diminfo[0].shape;
15676  if (unlikely(__pyx_t_10 < 0)) __pyx_t_7 = 0;
15677  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_dm.diminfo[0].shape)) __pyx_t_7 = 0;
15678  if (__pyx_t_11 < 0) {
15679  __pyx_t_11 += __pyx_pybuffernd_dm.diminfo[1].shape;
15680  if (unlikely(__pyx_t_11 < 0)) __pyx_t_7 = 1;
15681  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_dm.diminfo[1].shape)) __pyx_t_7 = 1;
15682  if (unlikely(__pyx_t_7 != -1)) {
15683  __Pyx_RaiseBufferIndexError(__pyx_t_7);
15684  __PYX_ERR(0, 748, __pyx_L1_error)
15685  }
15686  __pyx_v_omega_e = (__pyx_v_omega_e + ((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_dV.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dm.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_dm.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_dm.diminfo[1].strides))));
15687  }
15688 
15689  /* "subsurfaceTransportFunctions.pyx":749
15690  * vol_e += dV[eN,k]
15691  * omega_e += dV[eN,k]*dm[eN,k]
15692  * for k in range(df.shape[1]): # <<<<<<<<<<<<<<
15693  * for I in range(df.shape[2]):
15694  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
15695  */
15696  __pyx_t_3 = (__pyx_v_df->dimensions[1]);
15697  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
15698  __pyx_v_k = __pyx_t_4;
15699 
15700  /* "subsurfaceTransportFunctions.pyx":750
15701  * omega_e += dV[eN,k]*dm[eN,k]
15702  * for k in range(df.shape[1]):
15703  * for I in range(df.shape[2]): # <<<<<<<<<<<<<<
15704  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
15705  *
15706  */
15707  __pyx_t_12 = (__pyx_v_df->dimensions[2]);
15708  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_12; __pyx_t_7+=1) {
15709  __pyx_v_I = __pyx_t_7;
15710 
15711  /* "subsurfaceTransportFunctions.pyx":751
15712  * for k in range(df.shape[1]):
15713  * for I in range(df.shape[2]):
15714  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12) # <<<<<<<<<<<<<<
15715  *
15716  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs,
15717  */
15718  __pyx_t_13 = __pyx_v_eN;
15719  __pyx_t_14 = __pyx_v_k;
15720  __pyx_t_15 = __pyx_v_I;
15721  __pyx_t_16 = -1;
15722  if (__pyx_t_13 < 0) {
15723  __pyx_t_13 += __pyx_pybuffernd_df.diminfo[0].shape;
15724  if (unlikely(__pyx_t_13 < 0)) __pyx_t_16 = 0;
15725  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_df.diminfo[0].shape)) __pyx_t_16 = 0;
15726  if (__pyx_t_14 < 0) {
15727  __pyx_t_14 += __pyx_pybuffernd_df.diminfo[1].shape;
15728  if (unlikely(__pyx_t_14 < 0)) __pyx_t_16 = 1;
15729  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_df.diminfo[1].shape)) __pyx_t_16 = 1;
15730  if (__pyx_t_15 < 0) {
15731  __pyx_t_15 += __pyx_pybuffernd_df.diminfo[2].shape;
15732  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 2;
15733  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_df.diminfo[2].shape)) __pyx_t_16 = 2;
15734  if (unlikely(__pyx_t_16 != -1)) {
15735  __Pyx_RaiseBufferIndexError(__pyx_t_16);
15736  __PYX_ERR(0, 751, __pyx_L1_error)
15737  }
15738  __pyx_t_17 = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_df.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_df.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_df.diminfo[1].strides, __pyx_t_15, __pyx_pybuffernd_df.diminfo[2].strides)) * __pyx_v_vol_e);
15739  __pyx_t_18 = (__pyx_v_omega_e + 1.0e-12);
15740  if (unlikely(__pyx_t_18 == 0)) {
15741  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
15742  __PYX_ERR(0, 751, __pyx_L1_error)
15743  }
15744  __pyx_t_19 = __pyx_v_eN;
15745  __pyx_t_20 = __pyx_v_k;
15746  __pyx_t_21 = __pyx_v_I;
15747  __pyx_t_16 = -1;
15748  if (__pyx_t_19 < 0) {
15749  __pyx_t_19 += __pyx_pybuffernd_characteristic_velocity.diminfo[0].shape;
15750  if (unlikely(__pyx_t_19 < 0)) __pyx_t_16 = 0;
15751  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_characteristic_velocity.diminfo[0].shape)) __pyx_t_16 = 0;
15752  if (__pyx_t_20 < 0) {
15753  __pyx_t_20 += __pyx_pybuffernd_characteristic_velocity.diminfo[1].shape;
15754  if (unlikely(__pyx_t_20 < 0)) __pyx_t_16 = 1;
15755  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_characteristic_velocity.diminfo[1].shape)) __pyx_t_16 = 1;
15756  if (__pyx_t_21 < 0) {
15757  __pyx_t_21 += __pyx_pybuffernd_characteristic_velocity.diminfo[2].shape;
15758  if (unlikely(__pyx_t_21 < 0)) __pyx_t_16 = 2;
15759  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_characteristic_velocity.diminfo[2].shape)) __pyx_t_16 = 2;
15760  if (unlikely(__pyx_t_16 != -1)) {
15761  __Pyx_RaiseBufferIndexError(__pyx_t_16);
15762  __PYX_ERR(0, 751, __pyx_L1_error)
15763  }
15764  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_characteristic_velocity.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_characteristic_velocity.diminfo[1].strides, __pyx_t_21, __pyx_pybuffernd_characteristic_velocity.diminfo[2].strides) = (__pyx_t_17 / __pyx_t_18);
15765  }
15766  }
15767  }
15768 
15769  /* "subsurfaceTransportFunctions.pyx":732
15770  * flux[eN,ebN] = integral
15771  *
15772  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df, # <<<<<<<<<<<<<<
15773  * numpy.ndarray[DTYPE_t,ndim=3] characteristic_velocity,
15774  * numpy.ndarray[DTYPE_t,ndim=2] dm,
15775  */
15776 
15777  /* function exit code */
15778  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15779  goto __pyx_L0;
15780  __pyx_L1_error:;
15781  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
15782  __Pyx_PyThreadState_declare
15783  __Pyx_PyThreadState_assign
15784  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
15785  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer);
15786  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
15787  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_df.rcbuffer->pybuffer);
15788  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dm.rcbuffer->pybuffer);
15789  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
15790  __Pyx_AddTraceback("subsurfaceTransportFunctions.computeSimpleCharacteristicVelocityFromElementVelocity", __pyx_clineno, __pyx_lineno, __pyx_filename);
15791  __pyx_r = NULL;
15792  goto __pyx_L2;
15793  __pyx_L0:;
15794  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer);
15795  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
15796  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_df.rcbuffer->pybuffer);
15797  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dm.rcbuffer->pybuffer);
15798  __pyx_L2:;
15799  __Pyx_XGIVEREF(__pyx_r);
15800  __Pyx_RefNannyFinishContext();
15801  return __pyx_r;
15802 }
15803 
15804 /* "subsurfaceTransportFunctions.pyx":753
15805  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
15806  *
15807  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs, # <<<<<<<<<<<<<<
15808  * numpy.ndarray[DTYPE_t,ndim=1] characteristic_velocity_dofs,
15809  * numpy.ndarray[ITYPE_t,ndim=2] l2g,
15810  */
15811 
15812 /* Python wrapper */
15813 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
15814 static char __pyx_doc_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs[] = "\n simple approximation for \\lambda = df/\010ar{dm} using \010ar{dm} = \014rac{1}{\\Omega_e} \\int_{\\Omega_e} dm dV\n ";
15815 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs = {"computeSimpleCharacteristicVelocityFromVelocityDOFs", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs};
15816 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15817  PyArrayObject *__pyx_v_df_dofs = 0;
15818  PyArrayObject *__pyx_v_characteristic_velocity_dofs = 0;
15819  PyArrayObject *__pyx_v_l2g = 0;
15820  PyArrayObject *__pyx_v_dm = 0;
15821  PyArrayObject *__pyx_v_dV = 0;
15822  PyObject *__pyx_r = 0;
15823  __Pyx_RefNannyDeclarations
15824  __Pyx_RefNannySetupContext("computeSimpleCharacteristicVelocityFromVelocityDOFs (wrapper)", 0);
15825  {
15826  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_df_dofs,&__pyx_n_s_characteristic_velocity_dofs,&__pyx_n_s_l2g,&__pyx_n_s_dm,&__pyx_n_s_dV,0};
15827  PyObject* values[5] = {0,0,0,0,0};
15828  if (unlikely(__pyx_kwds)) {
15829  Py_ssize_t kw_args;
15830  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
15831  switch (pos_args) {
15832  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
15833  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15834  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15835  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15836  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15837  case 0: break;
15838  default: goto __pyx_L5_argtuple_error;
15839  }
15840  kw_args = PyDict_Size(__pyx_kwds);
15841  switch (pos_args) {
15842  case 0:
15843  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_df_dofs)) != 0)) kw_args--;
15844  else goto __pyx_L5_argtuple_error;
15845  case 1:
15846  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_characteristic_velocity_dofs)) != 0)) kw_args--;
15847  else {
15848  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, 1); __PYX_ERR(0, 753, __pyx_L3_error)
15849  }
15850  case 2:
15851  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_l2g)) != 0)) kw_args--;
15852  else {
15853  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, 2); __PYX_ERR(0, 753, __pyx_L3_error)
15854  }
15855  case 3:
15856  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dm)) != 0)) kw_args--;
15857  else {
15858  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, 3); __PYX_ERR(0, 753, __pyx_L3_error)
15859  }
15860  case 4:
15861  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dV)) != 0)) kw_args--;
15862  else {
15863  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, 4); __PYX_ERR(0, 753, __pyx_L3_error)
15864  }
15865  }
15866  if (unlikely(kw_args > 0)) {
15867  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeSimpleCharacteristicVelocityFromVelocityDOFs") < 0)) __PYX_ERR(0, 753, __pyx_L3_error)
15868  }
15869  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
15870  goto __pyx_L5_argtuple_error;
15871  } else {
15872  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15873  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15874  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15875  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15876  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
15877  }
15878  __pyx_v_df_dofs = ((PyArrayObject *)values[0]);
15879  __pyx_v_characteristic_velocity_dofs = ((PyArrayObject *)values[1]);
15880  __pyx_v_l2g = ((PyArrayObject *)values[2]);
15881  __pyx_v_dm = ((PyArrayObject *)values[3]);
15882  __pyx_v_dV = ((PyArrayObject *)values[4]);
15883  }
15884  goto __pyx_L4_argument_unpacking_done;
15885  __pyx_L5_argtuple_error:;
15886  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 753, __pyx_L3_error)
15887  __pyx_L3_error:;
15888  __Pyx_AddTraceback("subsurfaceTransportFunctions.computeSimpleCharacteristicVelocityFromVelocityDOFs", __pyx_clineno, __pyx_lineno, __pyx_filename);
15889  __Pyx_RefNannyFinishContext();
15890  return NULL;
15891  __pyx_L4_argument_unpacking_done:;
15892  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_df_dofs), __pyx_ptype_5numpy_ndarray, 1, "df_dofs", 0))) __PYX_ERR(0, 753, __pyx_L1_error)
15893  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_characteristic_velocity_dofs), __pyx_ptype_5numpy_ndarray, 1, "characteristic_velocity_dofs", 0))) __PYX_ERR(0, 754, __pyx_L1_error)
15894  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_l2g), __pyx_ptype_5numpy_ndarray, 1, "l2g", 0))) __PYX_ERR(0, 755, __pyx_L1_error)
15895  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dm), __pyx_ptype_5numpy_ndarray, 1, "dm", 0))) __PYX_ERR(0, 756, __pyx_L1_error)
15896  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dV), __pyx_ptype_5numpy_ndarray, 1, "dV", 0))) __PYX_ERR(0, 757, __pyx_L1_error)
15897  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs(__pyx_self, __pyx_v_df_dofs, __pyx_v_characteristic_velocity_dofs, __pyx_v_l2g, __pyx_v_dm, __pyx_v_dV);
15898 
15899  /* function exit code */
15900  goto __pyx_L0;
15901  __pyx_L1_error:;
15902  __pyx_r = NULL;
15903  __pyx_L0:;
15904  __Pyx_RefNannyFinishContext();
15905  return __pyx_r;
15906 }
15907 
15908 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_df_dofs, PyArrayObject *__pyx_v_characteristic_velocity_dofs, PyArrayObject *__pyx_v_l2g, PyArrayObject *__pyx_v_dm, PyArrayObject *__pyx_v_dV) {
15909  int __pyx_v_eN;
15910  int __pyx_v_k;
15911  int __pyx_v_j;
15912  int __pyx_v_J;
15913  double __pyx_v_omega_e;
15914  double __pyx_v_vol_e;
15915  __Pyx_LocalBuf_ND __pyx_pybuffernd_characteristic_velocity_dofs;
15916  __Pyx_Buffer __pyx_pybuffer_characteristic_velocity_dofs;
15917  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
15918  __Pyx_Buffer __pyx_pybuffer_dV;
15919  __Pyx_LocalBuf_ND __pyx_pybuffernd_df_dofs;
15920  __Pyx_Buffer __pyx_pybuffer_df_dofs;
15921  __Pyx_LocalBuf_ND __pyx_pybuffernd_dm;
15922  __Pyx_Buffer __pyx_pybuffer_dm;
15923  __Pyx_LocalBuf_ND __pyx_pybuffernd_l2g;
15924  __Pyx_Buffer __pyx_pybuffer_l2g;
15925  PyObject *__pyx_r = NULL;
15926  __Pyx_RefNannyDeclarations
15927  npy_intp __pyx_t_1;
15928  int __pyx_t_2;
15929  npy_intp __pyx_t_3;
15930  int __pyx_t_4;
15931  Py_ssize_t __pyx_t_5;
15932  Py_ssize_t __pyx_t_6;
15933  int __pyx_t_7;
15934  Py_ssize_t __pyx_t_8;
15935  Py_ssize_t __pyx_t_9;
15936  Py_ssize_t __pyx_t_10;
15937  Py_ssize_t __pyx_t_11;
15938  Py_ssize_t __pyx_t_12;
15939  Py_ssize_t __pyx_t_13;
15940  Py_ssize_t __pyx_t_14;
15941  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_15;
15942  double __pyx_t_16;
15943  Py_ssize_t __pyx_t_17;
15944  __Pyx_RefNannySetupContext("computeSimpleCharacteristicVelocityFromVelocityDOFs", 0);
15945  __pyx_pybuffer_df_dofs.pybuffer.buf = NULL;
15946  __pyx_pybuffer_df_dofs.refcount = 0;
15947  __pyx_pybuffernd_df_dofs.data = NULL;
15948  __pyx_pybuffernd_df_dofs.rcbuffer = &__pyx_pybuffer_df_dofs;
15949  __pyx_pybuffer_characteristic_velocity_dofs.pybuffer.buf = NULL;
15950  __pyx_pybuffer_characteristic_velocity_dofs.refcount = 0;
15951  __pyx_pybuffernd_characteristic_velocity_dofs.data = NULL;
15952  __pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer = &__pyx_pybuffer_characteristic_velocity_dofs;
15953  __pyx_pybuffer_l2g.pybuffer.buf = NULL;
15954  __pyx_pybuffer_l2g.refcount = 0;
15955  __pyx_pybuffernd_l2g.data = NULL;
15956  __pyx_pybuffernd_l2g.rcbuffer = &__pyx_pybuffer_l2g;
15957  __pyx_pybuffer_dm.pybuffer.buf = NULL;
15958  __pyx_pybuffer_dm.refcount = 0;
15959  __pyx_pybuffernd_dm.data = NULL;
15960  __pyx_pybuffernd_dm.rcbuffer = &__pyx_pybuffer_dm;
15961  __pyx_pybuffer_dV.pybuffer.buf = NULL;
15962  __pyx_pybuffer_dV.refcount = 0;
15963  __pyx_pybuffernd_dV.data = NULL;
15964  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
15965  {
15966  __Pyx_BufFmt_StackElem __pyx_stack[1];
15967  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_df_dofs.rcbuffer->pybuffer, (PyObject*)__pyx_v_df_dofs, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
15968  }
15969  __pyx_pybuffernd_df_dofs.diminfo[0].strides = __pyx_pybuffernd_df_dofs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_df_dofs.diminfo[0].shape = __pyx_pybuffernd_df_dofs.rcbuffer->pybuffer.shape[0];
15970  {
15971  __Pyx_BufFmt_StackElem __pyx_stack[1];
15972  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer, (PyObject*)__pyx_v_characteristic_velocity_dofs, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
15973  }
15974  __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].strides = __pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].shape = __pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer.shape[0];
15975  {
15976  __Pyx_BufFmt_StackElem __pyx_stack[1];
15977  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_l2g.rcbuffer->pybuffer, (PyObject*)__pyx_v_l2g, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
15978  }
15979  __pyx_pybuffernd_l2g.diminfo[0].strides = __pyx_pybuffernd_l2g.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_l2g.diminfo[0].shape = __pyx_pybuffernd_l2g.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_l2g.diminfo[1].strides = __pyx_pybuffernd_l2g.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_l2g.diminfo[1].shape = __pyx_pybuffernd_l2g.rcbuffer->pybuffer.shape[1];
15980  {
15981  __Pyx_BufFmt_StackElem __pyx_stack[1];
15982  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dm.rcbuffer->pybuffer, (PyObject*)__pyx_v_dm, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
15983  }
15984  __pyx_pybuffernd_dm.diminfo[0].strides = __pyx_pybuffernd_dm.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dm.diminfo[0].shape = __pyx_pybuffernd_dm.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dm.diminfo[1].strides = __pyx_pybuffernd_dm.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dm.diminfo[1].shape = __pyx_pybuffernd_dm.rcbuffer->pybuffer.shape[1];
15985  {
15986  __Pyx_BufFmt_StackElem __pyx_stack[1];
15987  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
15988  }
15989  __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dV.diminfo[1].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dV.diminfo[1].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[1];
15990 
15991  /* "subsurfaceTransportFunctions.pyx":765
15992  * cdef double omega_e, vol_e
15993  *
15994  * for eN in range(dm.shape[0]): # <<<<<<<<<<<<<<
15995  * omega_e = 0.0
15996  * vol_e = 0.0
15997  */
15998  __pyx_t_1 = (__pyx_v_dm->dimensions[0]);
15999  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
16000  __pyx_v_eN = __pyx_t_2;
16001 
16002  /* "subsurfaceTransportFunctions.pyx":766
16003  *
16004  * for eN in range(dm.shape[0]):
16005  * omega_e = 0.0 # <<<<<<<<<<<<<<
16006  * vol_e = 0.0
16007  * for k in range(dm.shape[1]):
16008  */
16009  __pyx_v_omega_e = 0.0;
16010 
16011  /* "subsurfaceTransportFunctions.pyx":767
16012  * for eN in range(dm.shape[0]):
16013  * omega_e = 0.0
16014  * vol_e = 0.0 # <<<<<<<<<<<<<<
16015  * for k in range(dm.shape[1]):
16016  * vol_e += dV[eN,k]
16017  */
16018  __pyx_v_vol_e = 0.0;
16019 
16020  /* "subsurfaceTransportFunctions.pyx":768
16021  * omega_e = 0.0
16022  * vol_e = 0.0
16023  * for k in range(dm.shape[1]): # <<<<<<<<<<<<<<
16024  * vol_e += dV[eN,k]
16025  * omega_e += dV[eN,k]*dm[eN,k]
16026  */
16027  __pyx_t_3 = (__pyx_v_dm->dimensions[1]);
16028  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
16029  __pyx_v_k = __pyx_t_4;
16030 
16031  /* "subsurfaceTransportFunctions.pyx":769
16032  * vol_e = 0.0
16033  * for k in range(dm.shape[1]):
16034  * vol_e += dV[eN,k] # <<<<<<<<<<<<<<
16035  * omega_e += dV[eN,k]*dm[eN,k]
16036  * for j in range(l2g.shape[1]):
16037  */
16038  __pyx_t_5 = __pyx_v_eN;
16039  __pyx_t_6 = __pyx_v_k;
16040  __pyx_t_7 = -1;
16041  if (__pyx_t_5 < 0) {
16042  __pyx_t_5 += __pyx_pybuffernd_dV.diminfo[0].shape;
16043  if (unlikely(__pyx_t_5 < 0)) __pyx_t_7 = 0;
16044  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_7 = 0;
16045  if (__pyx_t_6 < 0) {
16046  __pyx_t_6 += __pyx_pybuffernd_dV.diminfo[1].shape;
16047  if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 1;
16048  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_7 = 1;
16049  if (unlikely(__pyx_t_7 != -1)) {
16050  __Pyx_RaiseBufferIndexError(__pyx_t_7);
16051  __PYX_ERR(0, 769, __pyx_L1_error)
16052  }
16053  __pyx_v_vol_e = (__pyx_v_vol_e + (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_dV.diminfo[1].strides)));
16054 
16055  /* "subsurfaceTransportFunctions.pyx":770
16056  * for k in range(dm.shape[1]):
16057  * vol_e += dV[eN,k]
16058  * omega_e += dV[eN,k]*dm[eN,k] # <<<<<<<<<<<<<<
16059  * for j in range(l2g.shape[1]):
16060  * J = l2g[eN,j]
16061  */
16062  __pyx_t_8 = __pyx_v_eN;
16063  __pyx_t_9 = __pyx_v_k;
16064  __pyx_t_7 = -1;
16065  if (__pyx_t_8 < 0) {
16066  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[0].shape;
16067  if (unlikely(__pyx_t_8 < 0)) __pyx_t_7 = 0;
16068  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_7 = 0;
16069  if (__pyx_t_9 < 0) {
16070  __pyx_t_9 += __pyx_pybuffernd_dV.diminfo[1].shape;
16071  if (unlikely(__pyx_t_9 < 0)) __pyx_t_7 = 1;
16072  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_7 = 1;
16073  if (unlikely(__pyx_t_7 != -1)) {
16074  __Pyx_RaiseBufferIndexError(__pyx_t_7);
16075  __PYX_ERR(0, 770, __pyx_L1_error)
16076  }
16077  __pyx_t_10 = __pyx_v_eN;
16078  __pyx_t_11 = __pyx_v_k;
16079  __pyx_t_7 = -1;
16080  if (__pyx_t_10 < 0) {
16081  __pyx_t_10 += __pyx_pybuffernd_dm.diminfo[0].shape;
16082  if (unlikely(__pyx_t_10 < 0)) __pyx_t_7 = 0;
16083  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_dm.diminfo[0].shape)) __pyx_t_7 = 0;
16084  if (__pyx_t_11 < 0) {
16085  __pyx_t_11 += __pyx_pybuffernd_dm.diminfo[1].shape;
16086  if (unlikely(__pyx_t_11 < 0)) __pyx_t_7 = 1;
16087  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_dm.diminfo[1].shape)) __pyx_t_7 = 1;
16088  if (unlikely(__pyx_t_7 != -1)) {
16089  __Pyx_RaiseBufferIndexError(__pyx_t_7);
16090  __PYX_ERR(0, 770, __pyx_L1_error)
16091  }
16092  __pyx_v_omega_e = (__pyx_v_omega_e + ((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_dV.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dm.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_dm.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_dm.diminfo[1].strides))));
16093  }
16094 
16095  /* "subsurfaceTransportFunctions.pyx":771
16096  * vol_e += dV[eN,k]
16097  * omega_e += dV[eN,k]*dm[eN,k]
16098  * for j in range(l2g.shape[1]): # <<<<<<<<<<<<<<
16099  * J = l2g[eN,j]
16100  * characteristic_velocity_dofs[J] = df_dofs[J]*vol_e/(omega_e+1.0e-12)
16101  */
16102  __pyx_t_3 = (__pyx_v_l2g->dimensions[1]);
16103  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
16104  __pyx_v_j = __pyx_t_4;
16105 
16106  /* "subsurfaceTransportFunctions.pyx":772
16107  * omega_e += dV[eN,k]*dm[eN,k]
16108  * for j in range(l2g.shape[1]):
16109  * J = l2g[eN,j] # <<<<<<<<<<<<<<
16110  * characteristic_velocity_dofs[J] = df_dofs[J]*vol_e/(omega_e+1.0e-12)
16111  *
16112  */
16113  __pyx_t_12 = __pyx_v_eN;
16114  __pyx_t_13 = __pyx_v_j;
16115  __pyx_t_7 = -1;
16116  if (__pyx_t_12 < 0) {
16117  __pyx_t_12 += __pyx_pybuffernd_l2g.diminfo[0].shape;
16118  if (unlikely(__pyx_t_12 < 0)) __pyx_t_7 = 0;
16119  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_l2g.diminfo[0].shape)) __pyx_t_7 = 0;
16120  if (__pyx_t_13 < 0) {
16121  __pyx_t_13 += __pyx_pybuffernd_l2g.diminfo[1].shape;
16122  if (unlikely(__pyx_t_13 < 0)) __pyx_t_7 = 1;
16123  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_l2g.diminfo[1].shape)) __pyx_t_7 = 1;
16124  if (unlikely(__pyx_t_7 != -1)) {
16125  __Pyx_RaiseBufferIndexError(__pyx_t_7);
16126  __PYX_ERR(0, 772, __pyx_L1_error)
16127  }
16128  __pyx_v_J = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_l2g.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_l2g.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_l2g.diminfo[1].strides));
16129 
16130  /* "subsurfaceTransportFunctions.pyx":773
16131  * for j in range(l2g.shape[1]):
16132  * J = l2g[eN,j]
16133  * characteristic_velocity_dofs[J] = df_dofs[J]*vol_e/(omega_e+1.0e-12) # <<<<<<<<<<<<<<
16134  *
16135  * #problem specific velocity evaluation
16136  */
16137  __pyx_t_14 = __pyx_v_J;
16138  __pyx_t_7 = -1;
16139  if (__pyx_t_14 < 0) {
16140  __pyx_t_14 += __pyx_pybuffernd_df_dofs.diminfo[0].shape;
16141  if (unlikely(__pyx_t_14 < 0)) __pyx_t_7 = 0;
16142  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_df_dofs.diminfo[0].shape)) __pyx_t_7 = 0;
16143  if (unlikely(__pyx_t_7 != -1)) {
16144  __Pyx_RaiseBufferIndexError(__pyx_t_7);
16145  __PYX_ERR(0, 773, __pyx_L1_error)
16146  }
16147  __pyx_t_15 = ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_df_dofs.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_df_dofs.diminfo[0].strides)) * __pyx_v_vol_e);
16148  __pyx_t_16 = (__pyx_v_omega_e + 1.0e-12);
16149  if (unlikely(__pyx_t_16 == 0)) {
16150  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
16151  __PYX_ERR(0, 773, __pyx_L1_error)
16152  }
16153  __pyx_t_17 = __pyx_v_J;
16154  __pyx_t_7 = -1;
16155  if (__pyx_t_17 < 0) {
16156  __pyx_t_17 += __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].shape;
16157  if (unlikely(__pyx_t_17 < 0)) __pyx_t_7 = 0;
16158  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].shape)) __pyx_t_7 = 0;
16159  if (unlikely(__pyx_t_7 != -1)) {
16160  __Pyx_RaiseBufferIndexError(__pyx_t_7);
16161  __PYX_ERR(0, 773, __pyx_L1_error)
16162  }
16163  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].strides) = (__pyx_t_15 / __pyx_t_16);
16164  }
16165  }
16166 
16167  /* "subsurfaceTransportFunctions.pyx":753
16168  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
16169  *
16170  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs, # <<<<<<<<<<<<<<
16171  * numpy.ndarray[DTYPE_t,ndim=1] characteristic_velocity_dofs,
16172  * numpy.ndarray[ITYPE_t,ndim=2] l2g,
16173  */
16174 
16175  /* function exit code */
16176  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16177  goto __pyx_L0;
16178  __pyx_L1_error:;
16179  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
16180  __Pyx_PyThreadState_declare
16181  __Pyx_PyThreadState_assign
16182  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
16183  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer);
16184  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
16185  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_df_dofs.rcbuffer->pybuffer);
16186  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dm.rcbuffer->pybuffer);
16187  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_l2g.rcbuffer->pybuffer);
16188  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
16189  __Pyx_AddTraceback("subsurfaceTransportFunctions.computeSimpleCharacteristicVelocityFromVelocityDOFs", __pyx_clineno, __pyx_lineno, __pyx_filename);
16190  __pyx_r = NULL;
16191  goto __pyx_L2;
16192  __pyx_L0:;
16193  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer);
16194  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
16195  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_df_dofs.rcbuffer->pybuffer);
16196  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dm.rcbuffer->pybuffer);
16197  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_l2g.rcbuffer->pybuffer);
16198  __pyx_L2:;
16199  __Pyx_XGIVEREF(__pyx_r);
16200  __Pyx_RefNannyFinishContext();
16201  return __pyx_r;
16202 }
16203 
16204 /* "subsurfaceTransportFunctions.pyx":776
16205  *
16206  * #problem specific velocity evaluation
16207  * def rotatingGaussianElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
16208  * double t,
16209  * double tForReversal,
16210  */
16211 
16212 /* Python wrapper */
16213 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
16214 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3 = {"rotatingGaussianElementVelocityEval3", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3, METH_VARARGS|METH_KEYWORDS, 0};
16215 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
16216  int __pyx_v_transient;
16217  double __pyx_v_t;
16218  double __pyx_v_tForReversal;
16219  double __pyx_v_clock;
16220  double __pyx_v_xc;
16221  double __pyx_v_yc;
16222  PyArrayObject *__pyx_v_x = 0;
16223  PyArrayObject *__pyx_v_v = 0;
16224  double __pyx_v_zvelocity;
16225  PyObject *__pyx_r = 0;
16226  __Pyx_RefNannyDeclarations
16227  __Pyx_RefNannySetupContext("rotatingGaussianElementVelocityEval3 (wrapper)", 0);
16228  {
16229  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transient,&__pyx_n_s_t,&__pyx_n_s_tForReversal,&__pyx_n_s_clock,&__pyx_n_s_xc,&__pyx_n_s_yc,&__pyx_n_s_x,&__pyx_n_s_v,&__pyx_n_s_zvelocity,0};
16230  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
16231  if (unlikely(__pyx_kwds)) {
16232  Py_ssize_t kw_args;
16233  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
16234  switch (pos_args) {
16235  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
16236  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
16237  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
16238  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
16239  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
16240  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16241  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16242  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16243  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16244  case 0: break;
16245  default: goto __pyx_L5_argtuple_error;
16246  }
16247  kw_args = PyDict_Size(__pyx_kwds);
16248  switch (pos_args) {
16249  case 0:
16250  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_transient)) != 0)) kw_args--;
16251  else goto __pyx_L5_argtuple_error;
16252  case 1:
16253  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
16254  else {
16255  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 1); __PYX_ERR(0, 776, __pyx_L3_error)
16256  }
16257  case 2:
16258  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tForReversal)) != 0)) kw_args--;
16259  else {
16260  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 2); __PYX_ERR(0, 776, __pyx_L3_error)
16261  }
16262  case 3:
16263  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_clock)) != 0)) kw_args--;
16264  else {
16265  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 3); __PYX_ERR(0, 776, __pyx_L3_error)
16266  }
16267  case 4:
16268  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xc)) != 0)) kw_args--;
16269  else {
16270  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 4); __PYX_ERR(0, 776, __pyx_L3_error)
16271  }
16272  case 5:
16273  if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_yc)) != 0)) kw_args--;
16274  else {
16275  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 5); __PYX_ERR(0, 776, __pyx_L3_error)
16276  }
16277  case 6:
16278  if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
16279  else {
16280  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 6); __PYX_ERR(0, 776, __pyx_L3_error)
16281  }
16282  case 7:
16283  if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
16284  else {
16285  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 7); __PYX_ERR(0, 776, __pyx_L3_error)
16286  }
16287  case 8:
16288  if (kw_args > 0) {
16289  PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_zvelocity);
16290  if (value) { values[8] = value; kw_args--; }
16291  }
16292  }
16293  if (unlikely(kw_args > 0)) {
16294  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rotatingGaussianElementVelocityEval3") < 0)) __PYX_ERR(0, 776, __pyx_L3_error)
16295  }
16296  } else {
16297  switch (PyTuple_GET_SIZE(__pyx_args)) {
16298  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
16299  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
16300  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
16301  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
16302  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
16303  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16304  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16305  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16306  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16307  break;
16308  default: goto __pyx_L5_argtuple_error;
16309  }
16310  }
16311  __pyx_v_transient = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_transient == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 776, __pyx_L3_error)
16312  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 777, __pyx_L3_error)
16313  __pyx_v_tForReversal = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tForReversal == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 778, __pyx_L3_error)
16314  __pyx_v_clock = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_clock == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 779, __pyx_L3_error)
16315  __pyx_v_xc = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_xc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 780, __pyx_L3_error)
16316  __pyx_v_yc = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 780, __pyx_L3_error)
16317  __pyx_v_x = ((PyArrayObject *)values[6]);
16318  __pyx_v_v = ((PyArrayObject *)values[7]);
16319  if (values[8]) {
16320  __pyx_v_zvelocity = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_zvelocity == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 783, __pyx_L3_error)
16321  } else {
16322  __pyx_v_zvelocity = ((double)0.0);
16323  }
16324  }
16325  goto __pyx_L4_argument_unpacking_done;
16326  __pyx_L5_argtuple_error:;
16327  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 776, __pyx_L3_error)
16328  __pyx_L3_error:;
16329  __Pyx_AddTraceback("subsurfaceTransportFunctions.rotatingGaussianElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
16330  __Pyx_RefNannyFinishContext();
16331  return NULL;
16332  __pyx_L4_argument_unpacking_done:;
16333  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 781, __pyx_L1_error)
16334  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 782, __pyx_L1_error)
16335  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_46rotatingGaussianElementVelocityEval3(__pyx_self, __pyx_v_transient, __pyx_v_t, __pyx_v_tForReversal, __pyx_v_clock, __pyx_v_xc, __pyx_v_yc, __pyx_v_x, __pyx_v_v, __pyx_v_zvelocity);
16336 
16337  /* function exit code */
16338  goto __pyx_L0;
16339  __pyx_L1_error:;
16340  __pyx_r = NULL;
16341  __pyx_L0:;
16342  __Pyx_RefNannyFinishContext();
16343  return __pyx_r;
16344 }
16345 
16346 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_46rotatingGaussianElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v, double __pyx_v_zvelocity) {
16347  int __pyx_v_eN;
16348  int __pyx_v_k;
16349  double __pyx_v_pi;
16350  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
16351  __Pyx_Buffer __pyx_pybuffer_v;
16352  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
16353  __Pyx_Buffer __pyx_pybuffer_x;
16354  PyObject *__pyx_r = NULL;
16355  __Pyx_RefNannyDeclarations
16356  int __pyx_t_1;
16357  npy_intp __pyx_t_2;
16358  int __pyx_t_3;
16359  npy_intp __pyx_t_4;
16360  int __pyx_t_5;
16361  Py_ssize_t __pyx_t_6;
16362  Py_ssize_t __pyx_t_7;
16363  Py_ssize_t __pyx_t_8;
16364  int __pyx_t_9;
16365  Py_ssize_t __pyx_t_10;
16366  Py_ssize_t __pyx_t_11;
16367  Py_ssize_t __pyx_t_12;
16368  Py_ssize_t __pyx_t_13;
16369  Py_ssize_t __pyx_t_14;
16370  Py_ssize_t __pyx_t_15;
16371  Py_ssize_t __pyx_t_16;
16372  Py_ssize_t __pyx_t_17;
16373  Py_ssize_t __pyx_t_18;
16374  Py_ssize_t __pyx_t_19;
16375  Py_ssize_t __pyx_t_20;
16376  Py_ssize_t __pyx_t_21;
16377  PyObject *__pyx_t_22 = NULL;
16378  PyObject *__pyx_t_23 = NULL;
16379  PyObject *__pyx_t_24 = NULL;
16380  double __pyx_t_25;
16381  double __pyx_t_26;
16382  PyObject *__pyx_t_27 = NULL;
16383  Py_ssize_t __pyx_t_28;
16384  Py_ssize_t __pyx_t_29;
16385  Py_ssize_t __pyx_t_30;
16386  Py_ssize_t __pyx_t_31;
16387  Py_ssize_t __pyx_t_32;
16388  Py_ssize_t __pyx_t_33;
16389  Py_ssize_t __pyx_t_34;
16390  Py_ssize_t __pyx_t_35;
16391  Py_ssize_t __pyx_t_36;
16392  Py_ssize_t __pyx_t_37;
16393  Py_ssize_t __pyx_t_38;
16394  Py_ssize_t __pyx_t_39;
16395  Py_ssize_t __pyx_t_40;
16396  Py_ssize_t __pyx_t_41;
16397  Py_ssize_t __pyx_t_42;
16398  Py_ssize_t __pyx_t_43;
16399  Py_ssize_t __pyx_t_44;
16400  Py_ssize_t __pyx_t_45;
16401  Py_ssize_t __pyx_t_46;
16402  Py_ssize_t __pyx_t_47;
16403  Py_ssize_t __pyx_t_48;
16404  Py_ssize_t __pyx_t_49;
16405  Py_ssize_t __pyx_t_50;
16406  Py_ssize_t __pyx_t_51;
16407  Py_ssize_t __pyx_t_52;
16408  Py_ssize_t __pyx_t_53;
16409  Py_ssize_t __pyx_t_54;
16410  Py_ssize_t __pyx_t_55;
16411  Py_ssize_t __pyx_t_56;
16412  Py_ssize_t __pyx_t_57;
16413  Py_ssize_t __pyx_t_58;
16414  Py_ssize_t __pyx_t_59;
16415  Py_ssize_t __pyx_t_60;
16416  Py_ssize_t __pyx_t_61;
16417  Py_ssize_t __pyx_t_62;
16418  Py_ssize_t __pyx_t_63;
16419  Py_ssize_t __pyx_t_64;
16420  Py_ssize_t __pyx_t_65;
16421  Py_ssize_t __pyx_t_66;
16422  __Pyx_RefNannySetupContext("rotatingGaussianElementVelocityEval3", 0);
16423  __pyx_pybuffer_x.pybuffer.buf = NULL;
16424  __pyx_pybuffer_x.refcount = 0;
16425  __pyx_pybuffernd_x.data = NULL;
16426  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
16427  __pyx_pybuffer_v.pybuffer.buf = NULL;
16428  __pyx_pybuffer_v.refcount = 0;
16429  __pyx_pybuffernd_v.data = NULL;
16430  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
16431  {
16432  __Pyx_BufFmt_StackElem __pyx_stack[1];
16433  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 776, __pyx_L1_error)
16434  }
16435  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
16436  {
16437  __Pyx_BufFmt_StackElem __pyx_stack[1];
16438  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 776, __pyx_L1_error)
16439  }
16440  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2];
16441 
16442  /* "subsurfaceTransportFunctions.pyx":786
16443  * cdef int eN,k
16444  * cdef double pi
16445  * pi = M_PI # <<<<<<<<<<<<<<
16446  * if v.shape[2] == 3:
16447  * if transient == 1:
16448  */
16449  __pyx_v_pi = M_PI;
16450 
16451  /* "subsurfaceTransportFunctions.pyx":787
16452  * cdef double pi
16453  * pi = M_PI
16454  * if v.shape[2] == 3: # <<<<<<<<<<<<<<
16455  * if transient == 1:
16456  * for eN in range(x.shape[0]):
16457  */
16458  __pyx_t_1 = (((__pyx_v_v->dimensions[2]) == 3) != 0);
16459  if (__pyx_t_1) {
16460 
16461  /* "subsurfaceTransportFunctions.pyx":788
16462  * pi = M_PI
16463  * if v.shape[2] == 3:
16464  * if transient == 1: # <<<<<<<<<<<<<<
16465  * for eN in range(x.shape[0]):
16466  * for k in range(x.shape[1]):
16467  */
16468  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
16469  if (__pyx_t_1) {
16470 
16471  /* "subsurfaceTransportFunctions.pyx":789
16472  * if v.shape[2] == 3:
16473  * if transient == 1:
16474  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
16475  * for k in range(x.shape[1]):
16476  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
16477  */
16478  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
16479  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
16480  __pyx_v_eN = __pyx_t_3;
16481 
16482  /* "subsurfaceTransportFunctions.pyx":790
16483  * if transient == 1:
16484  * for eN in range(x.shape[0]):
16485  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
16486  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
16487  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
16488  */
16489  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
16490  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
16491  __pyx_v_k = __pyx_t_5;
16492 
16493  /* "subsurfaceTransportFunctions.pyx":791
16494  * for eN in range(x.shape[0]):
16495  * for k in range(x.shape[1]):
16496  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
16497  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
16498  * v[eN,k,2]=zvelocity
16499  */
16500  __pyx_t_6 = __pyx_v_eN;
16501  __pyx_t_7 = __pyx_v_k;
16502  __pyx_t_8 = 1;
16503  __pyx_t_9 = -1;
16504  if (__pyx_t_6 < 0) {
16505  __pyx_t_6 += __pyx_pybuffernd_x.diminfo[0].shape;
16506  if (unlikely(__pyx_t_6 < 0)) __pyx_t_9 = 0;
16507  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_9 = 0;
16508  if (__pyx_t_7 < 0) {
16509  __pyx_t_7 += __pyx_pybuffernd_x.diminfo[1].shape;
16510  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1;
16511  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_9 = 1;
16512  if (__pyx_t_8 < 0) {
16513  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[2].shape;
16514  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 2;
16515  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_9 = 2;
16516  if (unlikely(__pyx_t_9 != -1)) {
16517  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16518  __PYX_ERR(0, 791, __pyx_L1_error)
16519  }
16520  __pyx_t_10 = __pyx_v_eN;
16521  __pyx_t_11 = __pyx_v_k;
16522  __pyx_t_12 = 0;
16523  __pyx_t_9 = -1;
16524  if (__pyx_t_10 < 0) {
16525  __pyx_t_10 += __pyx_pybuffernd_v.diminfo[0].shape;
16526  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
16527  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
16528  if (__pyx_t_11 < 0) {
16529  __pyx_t_11 += __pyx_pybuffernd_v.diminfo[1].shape;
16530  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
16531  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
16532  if (__pyx_t_12 < 0) {
16533  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[2].shape;
16534  if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 2;
16535  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
16536  if (unlikely(__pyx_t_9 != -1)) {
16537  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16538  __PYX_ERR(0, 791, __pyx_L1_error)
16539  }
16540  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
16541 
16542  /* "subsurfaceTransportFunctions.pyx":792
16543  * for k in range(x.shape[1]):
16544  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
16545  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
16546  * v[eN,k,2]=zvelocity
16547  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
16548  */
16549  __pyx_t_13 = __pyx_v_eN;
16550  __pyx_t_14 = __pyx_v_k;
16551  __pyx_t_15 = 0;
16552  __pyx_t_9 = -1;
16553  if (__pyx_t_13 < 0) {
16554  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[0].shape;
16555  if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 0;
16556  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_9 = 0;
16557  if (__pyx_t_14 < 0) {
16558  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[1].shape;
16559  if (unlikely(__pyx_t_14 < 0)) __pyx_t_9 = 1;
16560  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_9 = 1;
16561  if (__pyx_t_15 < 0) {
16562  __pyx_t_15 += __pyx_pybuffernd_x.diminfo[2].shape;
16563  if (unlikely(__pyx_t_15 < 0)) __pyx_t_9 = 2;
16564  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_9 = 2;
16565  if (unlikely(__pyx_t_9 != -1)) {
16566  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16567  __PYX_ERR(0, 792, __pyx_L1_error)
16568  }
16569  __pyx_t_16 = __pyx_v_eN;
16570  __pyx_t_17 = __pyx_v_k;
16571  __pyx_t_18 = 1;
16572  __pyx_t_9 = -1;
16573  if (__pyx_t_16 < 0) {
16574  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[0].shape;
16575  if (unlikely(__pyx_t_16 < 0)) __pyx_t_9 = 0;
16576  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
16577  if (__pyx_t_17 < 0) {
16578  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[1].shape;
16579  if (unlikely(__pyx_t_17 < 0)) __pyx_t_9 = 1;
16580  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
16581  if (__pyx_t_18 < 0) {
16582  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[2].shape;
16583  if (unlikely(__pyx_t_18 < 0)) __pyx_t_9 = 2;
16584  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
16585  if (unlikely(__pyx_t_9 != -1)) {
16586  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16587  __PYX_ERR(0, 792, __pyx_L1_error)
16588  }
16589  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_15, __pyx_pybuffernd_x.diminfo[2].strides))));
16590 
16591  /* "subsurfaceTransportFunctions.pyx":793
16592  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
16593  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
16594  * v[eN,k,2]=zvelocity # <<<<<<<<<<<<<<
16595  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
16596  * else:
16597  */
16598  __pyx_t_19 = __pyx_v_eN;
16599  __pyx_t_20 = __pyx_v_k;
16600  __pyx_t_21 = 2;
16601  __pyx_t_9 = -1;
16602  if (__pyx_t_19 < 0) {
16603  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[0].shape;
16604  if (unlikely(__pyx_t_19 < 0)) __pyx_t_9 = 0;
16605  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
16606  if (__pyx_t_20 < 0) {
16607  __pyx_t_20 += __pyx_pybuffernd_v.diminfo[1].shape;
16608  if (unlikely(__pyx_t_20 < 0)) __pyx_t_9 = 1;
16609  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
16610  if (__pyx_t_21 < 0) {
16611  __pyx_t_21 += __pyx_pybuffernd_v.diminfo[2].shape;
16612  if (unlikely(__pyx_t_21 < 0)) __pyx_t_9 = 2;
16613  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
16614  if (unlikely(__pyx_t_9 != -1)) {
16615  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16616  __PYX_ERR(0, 793, __pyx_L1_error)
16617  }
16618  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_21, __pyx_pybuffernd_v.diminfo[2].strides) = __pyx_v_zvelocity;
16619 
16620  /* "subsurfaceTransportFunctions.pyx":794
16621  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
16622  * v[eN,k,2]=zvelocity
16623  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
16624  * else:
16625  * for eN in range(x.shape[0]):
16626  */
16627  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 794, __pyx_L1_error)
16628  __Pyx_GOTREF(__pyx_t_22);
16629  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 794, __pyx_L1_error)
16630  __Pyx_GOTREF(__pyx_t_23);
16631  __pyx_t_24 = PyTuple_New(3); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 794, __pyx_L1_error)
16632  __Pyx_GOTREF(__pyx_t_24);
16633  __Pyx_GIVEREF(__pyx_t_22);
16634  PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_22);
16635  __Pyx_GIVEREF(__pyx_t_23);
16636  PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_23);
16637  __Pyx_INCREF(__pyx_slice__3);
16638  __Pyx_GIVEREF(__pyx_slice__3);
16639  PyTuple_SET_ITEM(__pyx_t_24, 2, __pyx_slice__3);
16640  __pyx_t_22 = 0;
16641  __pyx_t_23 = 0;
16642  __pyx_t_23 = PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_24); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 794, __pyx_L1_error)
16643  __Pyx_GOTREF(__pyx_t_23);
16644  __pyx_t_25 = (__pyx_v_tForReversal - __pyx_v_t);
16645  __pyx_t_26 = (__pyx_v_tForReversal - 0.0);
16646  if (unlikely(__pyx_t_26 == 0)) {
16647  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
16648  __PYX_ERR(0, 794, __pyx_L1_error)
16649  }
16650  __pyx_t_22 = PyFloat_FromDouble(((__pyx_t_25 / __pyx_t_26) * __pyx_v_clock)); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 794, __pyx_L1_error)
16651  __Pyx_GOTREF(__pyx_t_22);
16652  __pyx_t_27 = PyNumber_InPlaceMultiply(__pyx_t_23, __pyx_t_22); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 794, __pyx_L1_error)
16653  __Pyx_GOTREF(__pyx_t_27);
16654  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
16655  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
16656  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_24, __pyx_t_27) < 0)) __PYX_ERR(0, 794, __pyx_L1_error)
16657  __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
16658  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
16659  }
16660  }
16661 
16662  /* "subsurfaceTransportFunctions.pyx":788
16663  * pi = M_PI
16664  * if v.shape[2] == 3:
16665  * if transient == 1: # <<<<<<<<<<<<<<
16666  * for eN in range(x.shape[0]):
16667  * for k in range(x.shape[1]):
16668  */
16669  goto __pyx_L4;
16670  }
16671 
16672  /* "subsurfaceTransportFunctions.pyx":796
16673  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
16674  * else:
16675  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
16676  * for k in range(x.shape[1]):
16677  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
16678  */
16679  /*else*/ {
16680  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
16681  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
16682  __pyx_v_eN = __pyx_t_3;
16683 
16684  /* "subsurfaceTransportFunctions.pyx":797
16685  * else:
16686  * for eN in range(x.shape[0]):
16687  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
16688  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
16689  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
16690  */
16691  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
16692  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
16693  __pyx_v_k = __pyx_t_5;
16694 
16695  /* "subsurfaceTransportFunctions.pyx":798
16696  * for eN in range(x.shape[0]):
16697  * for k in range(x.shape[1]):
16698  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
16699  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
16700  * v[eN,k,2]=zvelocity
16701  */
16702  __pyx_t_28 = __pyx_v_eN;
16703  __pyx_t_29 = __pyx_v_k;
16704  __pyx_t_30 = 1;
16705  __pyx_t_9 = -1;
16706  if (__pyx_t_28 < 0) {
16707  __pyx_t_28 += __pyx_pybuffernd_x.diminfo[0].shape;
16708  if (unlikely(__pyx_t_28 < 0)) __pyx_t_9 = 0;
16709  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_9 = 0;
16710  if (__pyx_t_29 < 0) {
16711  __pyx_t_29 += __pyx_pybuffernd_x.diminfo[1].shape;
16712  if (unlikely(__pyx_t_29 < 0)) __pyx_t_9 = 1;
16713  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_9 = 1;
16714  if (__pyx_t_30 < 0) {
16715  __pyx_t_30 += __pyx_pybuffernd_x.diminfo[2].shape;
16716  if (unlikely(__pyx_t_30 < 0)) __pyx_t_9 = 2;
16717  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_9 = 2;
16718  if (unlikely(__pyx_t_9 != -1)) {
16719  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16720  __PYX_ERR(0, 798, __pyx_L1_error)
16721  }
16722  __pyx_t_31 = __pyx_v_eN;
16723  __pyx_t_32 = __pyx_v_k;
16724  __pyx_t_33 = 0;
16725  __pyx_t_9 = -1;
16726  if (__pyx_t_31 < 0) {
16727  __pyx_t_31 += __pyx_pybuffernd_v.diminfo[0].shape;
16728  if (unlikely(__pyx_t_31 < 0)) __pyx_t_9 = 0;
16729  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
16730  if (__pyx_t_32 < 0) {
16731  __pyx_t_32 += __pyx_pybuffernd_v.diminfo[1].shape;
16732  if (unlikely(__pyx_t_32 < 0)) __pyx_t_9 = 1;
16733  } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
16734  if (__pyx_t_33 < 0) {
16735  __pyx_t_33 += __pyx_pybuffernd_v.diminfo[2].shape;
16736  if (unlikely(__pyx_t_33 < 0)) __pyx_t_9 = 2;
16737  } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
16738  if (unlikely(__pyx_t_9 != -1)) {
16739  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16740  __PYX_ERR(0, 798, __pyx_L1_error)
16741  }
16742  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_33, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_30, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
16743 
16744  /* "subsurfaceTransportFunctions.pyx":799
16745  * for k in range(x.shape[1]):
16746  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
16747  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
16748  * v[eN,k,2]=zvelocity
16749  * else:
16750  */
16751  __pyx_t_34 = __pyx_v_eN;
16752  __pyx_t_35 = __pyx_v_k;
16753  __pyx_t_36 = 0;
16754  __pyx_t_9 = -1;
16755  if (__pyx_t_34 < 0) {
16756  __pyx_t_34 += __pyx_pybuffernd_x.diminfo[0].shape;
16757  if (unlikely(__pyx_t_34 < 0)) __pyx_t_9 = 0;
16758  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_9 = 0;
16759  if (__pyx_t_35 < 0) {
16760  __pyx_t_35 += __pyx_pybuffernd_x.diminfo[1].shape;
16761  if (unlikely(__pyx_t_35 < 0)) __pyx_t_9 = 1;
16762  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_9 = 1;
16763  if (__pyx_t_36 < 0) {
16764  __pyx_t_36 += __pyx_pybuffernd_x.diminfo[2].shape;
16765  if (unlikely(__pyx_t_36 < 0)) __pyx_t_9 = 2;
16766  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_9 = 2;
16767  if (unlikely(__pyx_t_9 != -1)) {
16768  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16769  __PYX_ERR(0, 799, __pyx_L1_error)
16770  }
16771  __pyx_t_37 = __pyx_v_eN;
16772  __pyx_t_38 = __pyx_v_k;
16773  __pyx_t_39 = 1;
16774  __pyx_t_9 = -1;
16775  if (__pyx_t_37 < 0) {
16776  __pyx_t_37 += __pyx_pybuffernd_v.diminfo[0].shape;
16777  if (unlikely(__pyx_t_37 < 0)) __pyx_t_9 = 0;
16778  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
16779  if (__pyx_t_38 < 0) {
16780  __pyx_t_38 += __pyx_pybuffernd_v.diminfo[1].shape;
16781  if (unlikely(__pyx_t_38 < 0)) __pyx_t_9 = 1;
16782  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
16783  if (__pyx_t_39 < 0) {
16784  __pyx_t_39 += __pyx_pybuffernd_v.diminfo[2].shape;
16785  if (unlikely(__pyx_t_39 < 0)) __pyx_t_9 = 2;
16786  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
16787  if (unlikely(__pyx_t_9 != -1)) {
16788  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16789  __PYX_ERR(0, 799, __pyx_L1_error)
16790  }
16791  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_39, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_36, __pyx_pybuffernd_x.diminfo[2].strides))));
16792 
16793  /* "subsurfaceTransportFunctions.pyx":800
16794  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
16795  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
16796  * v[eN,k,2]=zvelocity # <<<<<<<<<<<<<<
16797  * else:
16798  * assert v.shape[2] == 2
16799  */
16800  __pyx_t_40 = __pyx_v_eN;
16801  __pyx_t_41 = __pyx_v_k;
16802  __pyx_t_42 = 2;
16803  __pyx_t_9 = -1;
16804  if (__pyx_t_40 < 0) {
16805  __pyx_t_40 += __pyx_pybuffernd_v.diminfo[0].shape;
16806  if (unlikely(__pyx_t_40 < 0)) __pyx_t_9 = 0;
16807  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
16808  if (__pyx_t_41 < 0) {
16809  __pyx_t_41 += __pyx_pybuffernd_v.diminfo[1].shape;
16810  if (unlikely(__pyx_t_41 < 0)) __pyx_t_9 = 1;
16811  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
16812  if (__pyx_t_42 < 0) {
16813  __pyx_t_42 += __pyx_pybuffernd_v.diminfo[2].shape;
16814  if (unlikely(__pyx_t_42 < 0)) __pyx_t_9 = 2;
16815  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
16816  if (unlikely(__pyx_t_9 != -1)) {
16817  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16818  __PYX_ERR(0, 800, __pyx_L1_error)
16819  }
16820  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_42, __pyx_pybuffernd_v.diminfo[2].strides) = __pyx_v_zvelocity;
16821  }
16822  }
16823  }
16824  __pyx_L4:;
16825 
16826  /* "subsurfaceTransportFunctions.pyx":787
16827  * cdef double pi
16828  * pi = M_PI
16829  * if v.shape[2] == 3: # <<<<<<<<<<<<<<
16830  * if transient == 1:
16831  * for eN in range(x.shape[0]):
16832  */
16833  goto __pyx_L3;
16834  }
16835 
16836  /* "subsurfaceTransportFunctions.pyx":802
16837  * v[eN,k,2]=zvelocity
16838  * else:
16839  * assert v.shape[2] == 2 # <<<<<<<<<<<<<<
16840  * if transient == 1:
16841  * for eN in range(x.shape[0]):
16842  */
16843  /*else*/ {
16844  #ifndef CYTHON_WITHOUT_ASSERTIONS
16845  if (unlikely(!Py_OptimizeFlag)) {
16846  if (unlikely(!(((__pyx_v_v->dimensions[2]) == 2) != 0))) {
16847  PyErr_SetNone(PyExc_AssertionError);
16848  __PYX_ERR(0, 802, __pyx_L1_error)
16849  }
16850  }
16851  #endif
16852 
16853  /* "subsurfaceTransportFunctions.pyx":803
16854  * else:
16855  * assert v.shape[2] == 2
16856  * if transient == 1: # <<<<<<<<<<<<<<
16857  * for eN in range(x.shape[0]):
16858  * for k in range(x.shape[1]):
16859  */
16860  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
16861  if (__pyx_t_1) {
16862 
16863  /* "subsurfaceTransportFunctions.pyx":804
16864  * assert v.shape[2] == 2
16865  * if transient == 1:
16866  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
16867  * for k in range(x.shape[1]):
16868  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
16869  */
16870  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
16871  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
16872  __pyx_v_eN = __pyx_t_3;
16873 
16874  /* "subsurfaceTransportFunctions.pyx":805
16875  * if transient == 1:
16876  * for eN in range(x.shape[0]):
16877  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
16878  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
16879  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
16880  */
16881  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
16882  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
16883  __pyx_v_k = __pyx_t_5;
16884 
16885  /* "subsurfaceTransportFunctions.pyx":806
16886  * for eN in range(x.shape[0]):
16887  * for k in range(x.shape[1]):
16888  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
16889  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
16890  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
16891  */
16892  __pyx_t_43 = __pyx_v_eN;
16893  __pyx_t_44 = __pyx_v_k;
16894  __pyx_t_45 = 1;
16895  __pyx_t_9 = -1;
16896  if (__pyx_t_43 < 0) {
16897  __pyx_t_43 += __pyx_pybuffernd_x.diminfo[0].shape;
16898  if (unlikely(__pyx_t_43 < 0)) __pyx_t_9 = 0;
16899  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_9 = 0;
16900  if (__pyx_t_44 < 0) {
16901  __pyx_t_44 += __pyx_pybuffernd_x.diminfo[1].shape;
16902  if (unlikely(__pyx_t_44 < 0)) __pyx_t_9 = 1;
16903  } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_9 = 1;
16904  if (__pyx_t_45 < 0) {
16905  __pyx_t_45 += __pyx_pybuffernd_x.diminfo[2].shape;
16906  if (unlikely(__pyx_t_45 < 0)) __pyx_t_9 = 2;
16907  } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_9 = 2;
16908  if (unlikely(__pyx_t_9 != -1)) {
16909  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16910  __PYX_ERR(0, 806, __pyx_L1_error)
16911  }
16912  __pyx_t_46 = __pyx_v_eN;
16913  __pyx_t_47 = __pyx_v_k;
16914  __pyx_t_48 = 0;
16915  __pyx_t_9 = -1;
16916  if (__pyx_t_46 < 0) {
16917  __pyx_t_46 += __pyx_pybuffernd_v.diminfo[0].shape;
16918  if (unlikely(__pyx_t_46 < 0)) __pyx_t_9 = 0;
16919  } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
16920  if (__pyx_t_47 < 0) {
16921  __pyx_t_47 += __pyx_pybuffernd_v.diminfo[1].shape;
16922  if (unlikely(__pyx_t_47 < 0)) __pyx_t_9 = 1;
16923  } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
16924  if (__pyx_t_48 < 0) {
16925  __pyx_t_48 += __pyx_pybuffernd_v.diminfo[2].shape;
16926  if (unlikely(__pyx_t_48 < 0)) __pyx_t_9 = 2;
16927  } else if (unlikely(__pyx_t_48 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
16928  if (unlikely(__pyx_t_9 != -1)) {
16929  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16930  __PYX_ERR(0, 806, __pyx_L1_error)
16931  }
16932  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_48, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_44, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_45, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
16933 
16934  /* "subsurfaceTransportFunctions.pyx":807
16935  * for k in range(x.shape[1]):
16936  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
16937  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
16938  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
16939  * else:
16940  */
16941  __pyx_t_49 = __pyx_v_eN;
16942  __pyx_t_50 = __pyx_v_k;
16943  __pyx_t_51 = 0;
16944  __pyx_t_9 = -1;
16945  if (__pyx_t_49 < 0) {
16946  __pyx_t_49 += __pyx_pybuffernd_x.diminfo[0].shape;
16947  if (unlikely(__pyx_t_49 < 0)) __pyx_t_9 = 0;
16948  } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_9 = 0;
16949  if (__pyx_t_50 < 0) {
16950  __pyx_t_50 += __pyx_pybuffernd_x.diminfo[1].shape;
16951  if (unlikely(__pyx_t_50 < 0)) __pyx_t_9 = 1;
16952  } else if (unlikely(__pyx_t_50 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_9 = 1;
16953  if (__pyx_t_51 < 0) {
16954  __pyx_t_51 += __pyx_pybuffernd_x.diminfo[2].shape;
16955  if (unlikely(__pyx_t_51 < 0)) __pyx_t_9 = 2;
16956  } else if (unlikely(__pyx_t_51 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_9 = 2;
16957  if (unlikely(__pyx_t_9 != -1)) {
16958  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16959  __PYX_ERR(0, 807, __pyx_L1_error)
16960  }
16961  __pyx_t_52 = __pyx_v_eN;
16962  __pyx_t_53 = __pyx_v_k;
16963  __pyx_t_54 = 1;
16964  __pyx_t_9 = -1;
16965  if (__pyx_t_52 < 0) {
16966  __pyx_t_52 += __pyx_pybuffernd_v.diminfo[0].shape;
16967  if (unlikely(__pyx_t_52 < 0)) __pyx_t_9 = 0;
16968  } else if (unlikely(__pyx_t_52 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
16969  if (__pyx_t_53 < 0) {
16970  __pyx_t_53 += __pyx_pybuffernd_v.diminfo[1].shape;
16971  if (unlikely(__pyx_t_53 < 0)) __pyx_t_9 = 1;
16972  } else if (unlikely(__pyx_t_53 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
16973  if (__pyx_t_54 < 0) {
16974  __pyx_t_54 += __pyx_pybuffernd_v.diminfo[2].shape;
16975  if (unlikely(__pyx_t_54 < 0)) __pyx_t_9 = 2;
16976  } else if (unlikely(__pyx_t_54 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
16977  if (unlikely(__pyx_t_9 != -1)) {
16978  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16979  __PYX_ERR(0, 807, __pyx_L1_error)
16980  }
16981  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_53, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_54, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_50, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_51, __pyx_pybuffernd_x.diminfo[2].strides))));
16982 
16983  /* "subsurfaceTransportFunctions.pyx":808
16984  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
16985  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
16986  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
16987  * else:
16988  * for eN in range(x.shape[0]):
16989  */
16990  __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 808, __pyx_L1_error)
16991  __Pyx_GOTREF(__pyx_t_24);
16992  __pyx_t_27 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 808, __pyx_L1_error)
16993  __Pyx_GOTREF(__pyx_t_27);
16994  __pyx_t_22 = PyTuple_New(3); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 808, __pyx_L1_error)
16995  __Pyx_GOTREF(__pyx_t_22);
16996  __Pyx_GIVEREF(__pyx_t_24);
16997  PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_24);
16998  __Pyx_GIVEREF(__pyx_t_27);
16999  PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_27);
17000  __Pyx_INCREF(__pyx_slice__4);
17001  __Pyx_GIVEREF(__pyx_slice__4);
17002  PyTuple_SET_ITEM(__pyx_t_22, 2, __pyx_slice__4);
17003  __pyx_t_24 = 0;
17004  __pyx_t_27 = 0;
17005  __pyx_t_27 = PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_22); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 808, __pyx_L1_error)
17006  __Pyx_GOTREF(__pyx_t_27);
17007  __pyx_t_26 = (__pyx_v_tForReversal - __pyx_v_t);
17008  __pyx_t_25 = (__pyx_v_tForReversal - 0.0);
17009  if (unlikely(__pyx_t_25 == 0)) {
17010  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
17011  __PYX_ERR(0, 808, __pyx_L1_error)
17012  }
17013  __pyx_t_24 = PyFloat_FromDouble(((__pyx_t_26 / __pyx_t_25) * __pyx_v_clock)); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 808, __pyx_L1_error)
17014  __Pyx_GOTREF(__pyx_t_24);
17015  __pyx_t_23 = PyNumber_InPlaceMultiply(__pyx_t_27, __pyx_t_24); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 808, __pyx_L1_error)
17016  __Pyx_GOTREF(__pyx_t_23);
17017  __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
17018  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
17019  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_22, __pyx_t_23) < 0)) __PYX_ERR(0, 808, __pyx_L1_error)
17020  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
17021  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
17022  }
17023  }
17024 
17025  /* "subsurfaceTransportFunctions.pyx":803
17026  * else:
17027  * assert v.shape[2] == 2
17028  * if transient == 1: # <<<<<<<<<<<<<<
17029  * for eN in range(x.shape[0]):
17030  * for k in range(x.shape[1]):
17031  */
17032  goto __pyx_L13;
17033  }
17034 
17035  /* "subsurfaceTransportFunctions.pyx":810
17036  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17037  * else:
17038  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
17039  * for k in range(x.shape[1]):
17040  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17041  */
17042  /*else*/ {
17043  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
17044  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
17045  __pyx_v_eN = __pyx_t_3;
17046 
17047  /* "subsurfaceTransportFunctions.pyx":811
17048  * else:
17049  * for eN in range(x.shape[0]):
17050  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
17051  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17052  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17053  */
17054  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
17055  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
17056  __pyx_v_k = __pyx_t_5;
17057 
17058  /* "subsurfaceTransportFunctions.pyx":812
17059  * for eN in range(x.shape[0]):
17060  * for k in range(x.shape[1]):
17061  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
17062  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17063  *
17064  */
17065  __pyx_t_55 = __pyx_v_eN;
17066  __pyx_t_56 = __pyx_v_k;
17067  __pyx_t_57 = 1;
17068  __pyx_t_9 = -1;
17069  if (__pyx_t_55 < 0) {
17070  __pyx_t_55 += __pyx_pybuffernd_x.diminfo[0].shape;
17071  if (unlikely(__pyx_t_55 < 0)) __pyx_t_9 = 0;
17072  } else if (unlikely(__pyx_t_55 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_9 = 0;
17073  if (__pyx_t_56 < 0) {
17074  __pyx_t_56 += __pyx_pybuffernd_x.diminfo[1].shape;
17075  if (unlikely(__pyx_t_56 < 0)) __pyx_t_9 = 1;
17076  } else if (unlikely(__pyx_t_56 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_9 = 1;
17077  if (__pyx_t_57 < 0) {
17078  __pyx_t_57 += __pyx_pybuffernd_x.diminfo[2].shape;
17079  if (unlikely(__pyx_t_57 < 0)) __pyx_t_9 = 2;
17080  } else if (unlikely(__pyx_t_57 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_9 = 2;
17081  if (unlikely(__pyx_t_9 != -1)) {
17082  __Pyx_RaiseBufferIndexError(__pyx_t_9);
17083  __PYX_ERR(0, 812, __pyx_L1_error)
17084  }
17085  __pyx_t_58 = __pyx_v_eN;
17086  __pyx_t_59 = __pyx_v_k;
17087  __pyx_t_60 = 0;
17088  __pyx_t_9 = -1;
17089  if (__pyx_t_58 < 0) {
17090  __pyx_t_58 += __pyx_pybuffernd_v.diminfo[0].shape;
17091  if (unlikely(__pyx_t_58 < 0)) __pyx_t_9 = 0;
17092  } else if (unlikely(__pyx_t_58 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
17093  if (__pyx_t_59 < 0) {
17094  __pyx_t_59 += __pyx_pybuffernd_v.diminfo[1].shape;
17095  if (unlikely(__pyx_t_59 < 0)) __pyx_t_9 = 1;
17096  } else if (unlikely(__pyx_t_59 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
17097  if (__pyx_t_60 < 0) {
17098  __pyx_t_60 += __pyx_pybuffernd_v.diminfo[2].shape;
17099  if (unlikely(__pyx_t_60 < 0)) __pyx_t_9 = 2;
17100  } else if (unlikely(__pyx_t_60 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
17101  if (unlikely(__pyx_t_9 != -1)) {
17102  __Pyx_RaiseBufferIndexError(__pyx_t_9);
17103  __PYX_ERR(0, 812, __pyx_L1_error)
17104  }
17105  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_59, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_60, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_56, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_57, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
17106 
17107  /* "subsurfaceTransportFunctions.pyx":813
17108  * for k in range(x.shape[1]):
17109  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17110  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
17111  *
17112  *
17113  */
17114  __pyx_t_61 = __pyx_v_eN;
17115  __pyx_t_62 = __pyx_v_k;
17116  __pyx_t_63 = 0;
17117  __pyx_t_9 = -1;
17118  if (__pyx_t_61 < 0) {
17119  __pyx_t_61 += __pyx_pybuffernd_x.diminfo[0].shape;
17120  if (unlikely(__pyx_t_61 < 0)) __pyx_t_9 = 0;
17121  } else if (unlikely(__pyx_t_61 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_9 = 0;
17122  if (__pyx_t_62 < 0) {
17123  __pyx_t_62 += __pyx_pybuffernd_x.diminfo[1].shape;
17124  if (unlikely(__pyx_t_62 < 0)) __pyx_t_9 = 1;
17125  } else if (unlikely(__pyx_t_62 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_9 = 1;
17126  if (__pyx_t_63 < 0) {
17127  __pyx_t_63 += __pyx_pybuffernd_x.diminfo[2].shape;
17128  if (unlikely(__pyx_t_63 < 0)) __pyx_t_9 = 2;
17129  } else if (unlikely(__pyx_t_63 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_9 = 2;
17130  if (unlikely(__pyx_t_9 != -1)) {
17131  __Pyx_RaiseBufferIndexError(__pyx_t_9);
17132  __PYX_ERR(0, 813, __pyx_L1_error)
17133  }
17134  __pyx_t_64 = __pyx_v_eN;
17135  __pyx_t_65 = __pyx_v_k;
17136  __pyx_t_66 = 1;
17137  __pyx_t_9 = -1;
17138  if (__pyx_t_64 < 0) {
17139  __pyx_t_64 += __pyx_pybuffernd_v.diminfo[0].shape;
17140  if (unlikely(__pyx_t_64 < 0)) __pyx_t_9 = 0;
17141  } else if (unlikely(__pyx_t_64 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
17142  if (__pyx_t_65 < 0) {
17143  __pyx_t_65 += __pyx_pybuffernd_v.diminfo[1].shape;
17144  if (unlikely(__pyx_t_65 < 0)) __pyx_t_9 = 1;
17145  } else if (unlikely(__pyx_t_65 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
17146  if (__pyx_t_66 < 0) {
17147  __pyx_t_66 += __pyx_pybuffernd_v.diminfo[2].shape;
17148  if (unlikely(__pyx_t_66 < 0)) __pyx_t_9 = 2;
17149  } else if (unlikely(__pyx_t_66 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
17150  if (unlikely(__pyx_t_9 != -1)) {
17151  __Pyx_RaiseBufferIndexError(__pyx_t_9);
17152  __PYX_ERR(0, 813, __pyx_L1_error)
17153  }
17154  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_64, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_65, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_66, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_61, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_62, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_63, __pyx_pybuffernd_x.diminfo[2].strides))));
17155  }
17156  }
17157  }
17158  __pyx_L13:;
17159  }
17160  __pyx_L3:;
17161 
17162  /* "subsurfaceTransportFunctions.pyx":776
17163  *
17164  * #problem specific velocity evaluation
17165  * def rotatingGaussianElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
17166  * double t,
17167  * double tForReversal,
17168  */
17169 
17170  /* function exit code */
17171  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17172  goto __pyx_L0;
17173  __pyx_L1_error:;
17174  __Pyx_XDECREF(__pyx_t_22);
17175  __Pyx_XDECREF(__pyx_t_23);
17176  __Pyx_XDECREF(__pyx_t_24);
17177  __Pyx_XDECREF(__pyx_t_27);
17178  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
17179  __Pyx_PyThreadState_declare
17180  __Pyx_PyThreadState_assign
17181  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
17182  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
17183  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
17184  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
17185  __Pyx_AddTraceback("subsurfaceTransportFunctions.rotatingGaussianElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
17186  __pyx_r = NULL;
17187  goto __pyx_L2;
17188  __pyx_L0:;
17189  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
17190  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
17191  __pyx_L2:;
17192  __Pyx_XGIVEREF(__pyx_r);
17193  __Pyx_RefNannyFinishContext();
17194  return __pyx_r;
17195 }
17196 
17197 /* "subsurfaceTransportFunctions.pyx":816
17198  *
17199  *
17200  * def rotatingGaussianElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
17201  * double t,
17202  * double tForReversal,
17203  */
17204 
17205 /* Python wrapper */
17206 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
17207 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4 = {"rotatingGaussianElementVelocityEval4", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4, METH_VARARGS|METH_KEYWORDS, 0};
17208 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
17209  int __pyx_v_transient;
17210  double __pyx_v_t;
17211  double __pyx_v_tForReversal;
17212  double __pyx_v_clock;
17213  double __pyx_v_xc;
17214  double __pyx_v_yc;
17215  PyArrayObject *__pyx_v_x = 0;
17216  PyArrayObject *__pyx_v_v = 0;
17217  double __pyx_v_zvelocity;
17218  PyObject *__pyx_r = 0;
17219  __Pyx_RefNannyDeclarations
17220  __Pyx_RefNannySetupContext("rotatingGaussianElementVelocityEval4 (wrapper)", 0);
17221  {
17222  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transient,&__pyx_n_s_t,&__pyx_n_s_tForReversal,&__pyx_n_s_clock,&__pyx_n_s_xc,&__pyx_n_s_yc,&__pyx_n_s_x,&__pyx_n_s_v,&__pyx_n_s_zvelocity,0};
17223  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
17224  if (unlikely(__pyx_kwds)) {
17225  Py_ssize_t kw_args;
17226  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
17227  switch (pos_args) {
17228  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
17229  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
17230  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
17231  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
17232  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
17233  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
17234  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17235  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17236  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17237  case 0: break;
17238  default: goto __pyx_L5_argtuple_error;
17239  }
17240  kw_args = PyDict_Size(__pyx_kwds);
17241  switch (pos_args) {
17242  case 0:
17243  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_transient)) != 0)) kw_args--;
17244  else goto __pyx_L5_argtuple_error;
17245  case 1:
17246  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
17247  else {
17248  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 1); __PYX_ERR(0, 816, __pyx_L3_error)
17249  }
17250  case 2:
17251  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tForReversal)) != 0)) kw_args--;
17252  else {
17253  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 2); __PYX_ERR(0, 816, __pyx_L3_error)
17254  }
17255  case 3:
17256  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_clock)) != 0)) kw_args--;
17257  else {
17258  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 3); __PYX_ERR(0, 816, __pyx_L3_error)
17259  }
17260  case 4:
17261  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xc)) != 0)) kw_args--;
17262  else {
17263  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 4); __PYX_ERR(0, 816, __pyx_L3_error)
17264  }
17265  case 5:
17266  if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_yc)) != 0)) kw_args--;
17267  else {
17268  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 5); __PYX_ERR(0, 816, __pyx_L3_error)
17269  }
17270  case 6:
17271  if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
17272  else {
17273  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 6); __PYX_ERR(0, 816, __pyx_L3_error)
17274  }
17275  case 7:
17276  if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
17277  else {
17278  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 7); __PYX_ERR(0, 816, __pyx_L3_error)
17279  }
17280  case 8:
17281  if (kw_args > 0) {
17282  PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_zvelocity);
17283  if (value) { values[8] = value; kw_args--; }
17284  }
17285  }
17286  if (unlikely(kw_args > 0)) {
17287  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rotatingGaussianElementVelocityEval4") < 0)) __PYX_ERR(0, 816, __pyx_L3_error)
17288  }
17289  } else {
17290  switch (PyTuple_GET_SIZE(__pyx_args)) {
17291  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
17292  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
17293  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
17294  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
17295  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
17296  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
17297  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17298  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17299  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17300  break;
17301  default: goto __pyx_L5_argtuple_error;
17302  }
17303  }
17304  __pyx_v_transient = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_transient == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 816, __pyx_L3_error)
17305  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 817, __pyx_L3_error)
17306  __pyx_v_tForReversal = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tForReversal == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 818, __pyx_L3_error)
17307  __pyx_v_clock = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_clock == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 819, __pyx_L3_error)
17308  __pyx_v_xc = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_xc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 820, __pyx_L3_error)
17309  __pyx_v_yc = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 820, __pyx_L3_error)
17310  __pyx_v_x = ((PyArrayObject *)values[6]);
17311  __pyx_v_v = ((PyArrayObject *)values[7]);
17312  if (values[8]) {
17313  __pyx_v_zvelocity = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_zvelocity == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 823, __pyx_L3_error)
17314  } else {
17315  __pyx_v_zvelocity = ((double)0.0);
17316  }
17317  }
17318  goto __pyx_L4_argument_unpacking_done;
17319  __pyx_L5_argtuple_error:;
17320  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 816, __pyx_L3_error)
17321  __pyx_L3_error:;
17322  __Pyx_AddTraceback("subsurfaceTransportFunctions.rotatingGaussianElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
17323  __Pyx_RefNannyFinishContext();
17324  return NULL;
17325  __pyx_L4_argument_unpacking_done:;
17326  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 821, __pyx_L1_error)
17327  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 822, __pyx_L1_error)
17328  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_48rotatingGaussianElementVelocityEval4(__pyx_self, __pyx_v_transient, __pyx_v_t, __pyx_v_tForReversal, __pyx_v_clock, __pyx_v_xc, __pyx_v_yc, __pyx_v_x, __pyx_v_v, __pyx_v_zvelocity);
17329 
17330  /* function exit code */
17331  goto __pyx_L0;
17332  __pyx_L1_error:;
17333  __pyx_r = NULL;
17334  __pyx_L0:;
17335  __Pyx_RefNannyFinishContext();
17336  return __pyx_r;
17337 }
17338 
17339 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_48rotatingGaussianElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v, double __pyx_v_zvelocity) {
17340  int __pyx_v_eN;
17341  int __pyx_v_ebN;
17342  int __pyx_v_k;
17343  double __pyx_v_pi;
17344  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
17345  __Pyx_Buffer __pyx_pybuffer_v;
17346  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
17347  __Pyx_Buffer __pyx_pybuffer_x;
17348  PyObject *__pyx_r = NULL;
17349  __Pyx_RefNannyDeclarations
17350  int __pyx_t_1;
17351  npy_intp __pyx_t_2;
17352  int __pyx_t_3;
17353  npy_intp __pyx_t_4;
17354  int __pyx_t_5;
17355  npy_intp __pyx_t_6;
17356  int __pyx_t_7;
17357  Py_ssize_t __pyx_t_8;
17358  Py_ssize_t __pyx_t_9;
17359  Py_ssize_t __pyx_t_10;
17360  Py_ssize_t __pyx_t_11;
17361  int __pyx_t_12;
17362  Py_ssize_t __pyx_t_13;
17363  Py_ssize_t __pyx_t_14;
17364  Py_ssize_t __pyx_t_15;
17365  Py_ssize_t __pyx_t_16;
17366  Py_ssize_t __pyx_t_17;
17367  Py_ssize_t __pyx_t_18;
17368  Py_ssize_t __pyx_t_19;
17369  Py_ssize_t __pyx_t_20;
17370  Py_ssize_t __pyx_t_21;
17371  Py_ssize_t __pyx_t_22;
17372  Py_ssize_t __pyx_t_23;
17373  Py_ssize_t __pyx_t_24;
17374  Py_ssize_t __pyx_t_25;
17375  Py_ssize_t __pyx_t_26;
17376  Py_ssize_t __pyx_t_27;
17377  Py_ssize_t __pyx_t_28;
17378  PyObject *__pyx_t_29 = NULL;
17379  PyObject *__pyx_t_30 = NULL;
17380  PyObject *__pyx_t_31 = NULL;
17381  PyObject *__pyx_t_32 = NULL;
17382  double __pyx_t_33;
17383  double __pyx_t_34;
17384  Py_ssize_t __pyx_t_35;
17385  Py_ssize_t __pyx_t_36;
17386  Py_ssize_t __pyx_t_37;
17387  Py_ssize_t __pyx_t_38;
17388  Py_ssize_t __pyx_t_39;
17389  Py_ssize_t __pyx_t_40;
17390  Py_ssize_t __pyx_t_41;
17391  Py_ssize_t __pyx_t_42;
17392  Py_ssize_t __pyx_t_43;
17393  Py_ssize_t __pyx_t_44;
17394  Py_ssize_t __pyx_t_45;
17395  Py_ssize_t __pyx_t_46;
17396  Py_ssize_t __pyx_t_47;
17397  Py_ssize_t __pyx_t_48;
17398  Py_ssize_t __pyx_t_49;
17399  Py_ssize_t __pyx_t_50;
17400  Py_ssize_t __pyx_t_51;
17401  Py_ssize_t __pyx_t_52;
17402  Py_ssize_t __pyx_t_53;
17403  Py_ssize_t __pyx_t_54;
17404  Py_ssize_t __pyx_t_55;
17405  Py_ssize_t __pyx_t_56;
17406  Py_ssize_t __pyx_t_57;
17407  Py_ssize_t __pyx_t_58;
17408  Py_ssize_t __pyx_t_59;
17409  Py_ssize_t __pyx_t_60;
17410  Py_ssize_t __pyx_t_61;
17411  Py_ssize_t __pyx_t_62;
17412  Py_ssize_t __pyx_t_63;
17413  Py_ssize_t __pyx_t_64;
17414  Py_ssize_t __pyx_t_65;
17415  Py_ssize_t __pyx_t_66;
17416  Py_ssize_t __pyx_t_67;
17417  Py_ssize_t __pyx_t_68;
17418  Py_ssize_t __pyx_t_69;
17419  Py_ssize_t __pyx_t_70;
17420  Py_ssize_t __pyx_t_71;
17421  Py_ssize_t __pyx_t_72;
17422  Py_ssize_t __pyx_t_73;
17423  Py_ssize_t __pyx_t_74;
17424  Py_ssize_t __pyx_t_75;
17425  Py_ssize_t __pyx_t_76;
17426  Py_ssize_t __pyx_t_77;
17427  Py_ssize_t __pyx_t_78;
17428  Py_ssize_t __pyx_t_79;
17429  Py_ssize_t __pyx_t_80;
17430  Py_ssize_t __pyx_t_81;
17431  Py_ssize_t __pyx_t_82;
17432  Py_ssize_t __pyx_t_83;
17433  Py_ssize_t __pyx_t_84;
17434  Py_ssize_t __pyx_t_85;
17435  Py_ssize_t __pyx_t_86;
17436  __Pyx_RefNannySetupContext("rotatingGaussianElementVelocityEval4", 0);
17437  __pyx_pybuffer_x.pybuffer.buf = NULL;
17438  __pyx_pybuffer_x.refcount = 0;
17439  __pyx_pybuffernd_x.data = NULL;
17440  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
17441  __pyx_pybuffer_v.pybuffer.buf = NULL;
17442  __pyx_pybuffer_v.refcount = 0;
17443  __pyx_pybuffernd_v.data = NULL;
17444  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
17445  {
17446  __Pyx_BufFmt_StackElem __pyx_stack[1];
17447  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 816, __pyx_L1_error)
17448  }
17449  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
17450  {
17451  __Pyx_BufFmt_StackElem __pyx_stack[1];
17452  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 816, __pyx_L1_error)
17453  }
17454  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_v.diminfo[3].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_v.diminfo[3].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[3];
17455 
17456  /* "subsurfaceTransportFunctions.pyx":826
17457  * cdef int eN,ebN,k
17458  * cdef double pi
17459  * pi = M_PI # <<<<<<<<<<<<<<
17460  * if v.shape[-1] == 3:
17461  * if transient == 1:
17462  */
17463  __pyx_v_pi = M_PI;
17464 
17465  /* "subsurfaceTransportFunctions.pyx":827
17466  * cdef double pi
17467  * pi = M_PI
17468  * if v.shape[-1] == 3: # <<<<<<<<<<<<<<
17469  * if transient == 1:
17470  * for eN in range(x.shape[0]):
17471  */
17472  __pyx_t_1 = (((__pyx_v_v->dimensions[-1L]) == 3) != 0);
17473  if (__pyx_t_1) {
17474 
17475  /* "subsurfaceTransportFunctions.pyx":828
17476  * pi = M_PI
17477  * if v.shape[-1] == 3:
17478  * if transient == 1: # <<<<<<<<<<<<<<
17479  * for eN in range(x.shape[0]):
17480  * for ebN in range(x.shape[1]):
17481  */
17482  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
17483  if (__pyx_t_1) {
17484 
17485  /* "subsurfaceTransportFunctions.pyx":829
17486  * if v.shape[-1] == 3:
17487  * if transient == 1:
17488  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
17489  * for ebN in range(x.shape[1]):
17490  * for k in range(x.shape[2]):
17491  */
17492  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
17493  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
17494  __pyx_v_eN = __pyx_t_3;
17495 
17496  /* "subsurfaceTransportFunctions.pyx":830
17497  * if transient == 1:
17498  * for eN in range(x.shape[0]):
17499  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
17500  * for k in range(x.shape[2]):
17501  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
17502  */
17503  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
17504  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
17505  __pyx_v_ebN = __pyx_t_5;
17506 
17507  /* "subsurfaceTransportFunctions.pyx":831
17508  * for eN in range(x.shape[0]):
17509  * for ebN in range(x.shape[1]):
17510  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
17511  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
17512  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
17513  */
17514  __pyx_t_6 = (__pyx_v_x->dimensions[2]);
17515  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
17516  __pyx_v_k = __pyx_t_7;
17517 
17518  /* "subsurfaceTransportFunctions.pyx":832
17519  * for ebN in range(x.shape[1]):
17520  * for k in range(x.shape[2]):
17521  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
17522  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
17523  * v[eN,ebN,k,2]=zvelocity
17524  */
17525  __pyx_t_8 = __pyx_v_eN;
17526  __pyx_t_9 = __pyx_v_ebN;
17527  __pyx_t_10 = __pyx_v_k;
17528  __pyx_t_11 = 1;
17529  __pyx_t_12 = -1;
17530  if (__pyx_t_8 < 0) {
17531  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[0].shape;
17532  if (unlikely(__pyx_t_8 < 0)) __pyx_t_12 = 0;
17533  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_12 = 0;
17534  if (__pyx_t_9 < 0) {
17535  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
17536  if (unlikely(__pyx_t_9 < 0)) __pyx_t_12 = 1;
17537  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_12 = 1;
17538  if (__pyx_t_10 < 0) {
17539  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[2].shape;
17540  if (unlikely(__pyx_t_10 < 0)) __pyx_t_12 = 2;
17541  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_12 = 2;
17542  if (__pyx_t_11 < 0) {
17543  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[3].shape;
17544  if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 3;
17545  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_12 = 3;
17546  if (unlikely(__pyx_t_12 != -1)) {
17547  __Pyx_RaiseBufferIndexError(__pyx_t_12);
17548  __PYX_ERR(0, 832, __pyx_L1_error)
17549  }
17550  __pyx_t_13 = __pyx_v_eN;
17551  __pyx_t_14 = __pyx_v_ebN;
17552  __pyx_t_15 = __pyx_v_k;
17553  __pyx_t_16 = 0;
17554  __pyx_t_12 = -1;
17555  if (__pyx_t_13 < 0) {
17556  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[0].shape;
17557  if (unlikely(__pyx_t_13 < 0)) __pyx_t_12 = 0;
17558  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
17559  if (__pyx_t_14 < 0) {
17560  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[1].shape;
17561  if (unlikely(__pyx_t_14 < 0)) __pyx_t_12 = 1;
17562  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
17563  if (__pyx_t_15 < 0) {
17564  __pyx_t_15 += __pyx_pybuffernd_v.diminfo[2].shape;
17565  if (unlikely(__pyx_t_15 < 0)) __pyx_t_12 = 2;
17566  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
17567  if (__pyx_t_16 < 0) {
17568  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[3].shape;
17569  if (unlikely(__pyx_t_16 < 0)) __pyx_t_12 = 3;
17570  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
17571  if (unlikely(__pyx_t_12 != -1)) {
17572  __Pyx_RaiseBufferIndexError(__pyx_t_12);
17573  __PYX_ERR(0, 832, __pyx_L1_error)
17574  }
17575  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_15, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
17576 
17577  /* "subsurfaceTransportFunctions.pyx":833
17578  * for k in range(x.shape[2]):
17579  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
17580  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
17581  * v[eN,ebN,k,2]=zvelocity
17582  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17583  */
17584  __pyx_t_17 = __pyx_v_eN;
17585  __pyx_t_18 = __pyx_v_ebN;
17586  __pyx_t_19 = __pyx_v_k;
17587  __pyx_t_20 = 0;
17588  __pyx_t_12 = -1;
17589  if (__pyx_t_17 < 0) {
17590  __pyx_t_17 += __pyx_pybuffernd_x.diminfo[0].shape;
17591  if (unlikely(__pyx_t_17 < 0)) __pyx_t_12 = 0;
17592  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_12 = 0;
17593  if (__pyx_t_18 < 0) {
17594  __pyx_t_18 += __pyx_pybuffernd_x.diminfo[1].shape;
17595  if (unlikely(__pyx_t_18 < 0)) __pyx_t_12 = 1;
17596  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_12 = 1;
17597  if (__pyx_t_19 < 0) {
17598  __pyx_t_19 += __pyx_pybuffernd_x.diminfo[2].shape;
17599  if (unlikely(__pyx_t_19 < 0)) __pyx_t_12 = 2;
17600  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_12 = 2;
17601  if (__pyx_t_20 < 0) {
17602  __pyx_t_20 += __pyx_pybuffernd_x.diminfo[3].shape;
17603  if (unlikely(__pyx_t_20 < 0)) __pyx_t_12 = 3;
17604  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_12 = 3;
17605  if (unlikely(__pyx_t_12 != -1)) {
17606  __Pyx_RaiseBufferIndexError(__pyx_t_12);
17607  __PYX_ERR(0, 833, __pyx_L1_error)
17608  }
17609  __pyx_t_21 = __pyx_v_eN;
17610  __pyx_t_22 = __pyx_v_ebN;
17611  __pyx_t_23 = __pyx_v_k;
17612  __pyx_t_24 = 1;
17613  __pyx_t_12 = -1;
17614  if (__pyx_t_21 < 0) {
17615  __pyx_t_21 += __pyx_pybuffernd_v.diminfo[0].shape;
17616  if (unlikely(__pyx_t_21 < 0)) __pyx_t_12 = 0;
17617  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
17618  if (__pyx_t_22 < 0) {
17619  __pyx_t_22 += __pyx_pybuffernd_v.diminfo[1].shape;
17620  if (unlikely(__pyx_t_22 < 0)) __pyx_t_12 = 1;
17621  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
17622  if (__pyx_t_23 < 0) {
17623  __pyx_t_23 += __pyx_pybuffernd_v.diminfo[2].shape;
17624  if (unlikely(__pyx_t_23 < 0)) __pyx_t_12 = 2;
17625  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
17626  if (__pyx_t_24 < 0) {
17627  __pyx_t_24 += __pyx_pybuffernd_v.diminfo[3].shape;
17628  if (unlikely(__pyx_t_24 < 0)) __pyx_t_12 = 3;
17629  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
17630  if (unlikely(__pyx_t_12 != -1)) {
17631  __Pyx_RaiseBufferIndexError(__pyx_t_12);
17632  __PYX_ERR(0, 833, __pyx_L1_error)
17633  }
17634  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_23, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_24, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_19, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_20, __pyx_pybuffernd_x.diminfo[3].strides))));
17635 
17636  /* "subsurfaceTransportFunctions.pyx":834
17637  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
17638  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
17639  * v[eN,ebN,k,2]=zvelocity # <<<<<<<<<<<<<<
17640  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17641  * else:
17642  */
17643  __pyx_t_25 = __pyx_v_eN;
17644  __pyx_t_26 = __pyx_v_ebN;
17645  __pyx_t_27 = __pyx_v_k;
17646  __pyx_t_28 = 2;
17647  __pyx_t_12 = -1;
17648  if (__pyx_t_25 < 0) {
17649  __pyx_t_25 += __pyx_pybuffernd_v.diminfo[0].shape;
17650  if (unlikely(__pyx_t_25 < 0)) __pyx_t_12 = 0;
17651  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
17652  if (__pyx_t_26 < 0) {
17653  __pyx_t_26 += __pyx_pybuffernd_v.diminfo[1].shape;
17654  if (unlikely(__pyx_t_26 < 0)) __pyx_t_12 = 1;
17655  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
17656  if (__pyx_t_27 < 0) {
17657  __pyx_t_27 += __pyx_pybuffernd_v.diminfo[2].shape;
17658  if (unlikely(__pyx_t_27 < 0)) __pyx_t_12 = 2;
17659  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
17660  if (__pyx_t_28 < 0) {
17661  __pyx_t_28 += __pyx_pybuffernd_v.diminfo[3].shape;
17662  if (unlikely(__pyx_t_28 < 0)) __pyx_t_12 = 3;
17663  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
17664  if (unlikely(__pyx_t_12 != -1)) {
17665  __Pyx_RaiseBufferIndexError(__pyx_t_12);
17666  __PYX_ERR(0, 834, __pyx_L1_error)
17667  }
17668  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_27, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_28, __pyx_pybuffernd_v.diminfo[3].strides) = __pyx_v_zvelocity;
17669 
17670  /* "subsurfaceTransportFunctions.pyx":835
17671  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
17672  * v[eN,ebN,k,2]=zvelocity
17673  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
17674  * else:
17675  * for eN in range(x.shape[0]):
17676  */
17677  __pyx_t_29 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 835, __pyx_L1_error)
17678  __Pyx_GOTREF(__pyx_t_29);
17679  __pyx_t_30 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_30)) __PYX_ERR(0, 835, __pyx_L1_error)
17680  __Pyx_GOTREF(__pyx_t_30);
17681  __pyx_t_31 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 835, __pyx_L1_error)
17682  __Pyx_GOTREF(__pyx_t_31);
17683  __pyx_t_32 = PyTuple_New(4); if (unlikely(!__pyx_t_32)) __PYX_ERR(0, 835, __pyx_L1_error)
17684  __Pyx_GOTREF(__pyx_t_32);
17685  __Pyx_GIVEREF(__pyx_t_29);
17686  PyTuple_SET_ITEM(__pyx_t_32, 0, __pyx_t_29);
17687  __Pyx_GIVEREF(__pyx_t_30);
17688  PyTuple_SET_ITEM(__pyx_t_32, 1, __pyx_t_30);
17689  __Pyx_GIVEREF(__pyx_t_31);
17690  PyTuple_SET_ITEM(__pyx_t_32, 2, __pyx_t_31);
17691  __Pyx_INCREF(__pyx_slice__5);
17692  __Pyx_GIVEREF(__pyx_slice__5);
17693  PyTuple_SET_ITEM(__pyx_t_32, 3, __pyx_slice__5);
17694  __pyx_t_29 = 0;
17695  __pyx_t_30 = 0;
17696  __pyx_t_31 = 0;
17697  __pyx_t_31 = PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_32); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 835, __pyx_L1_error)
17698  __Pyx_GOTREF(__pyx_t_31);
17699  __pyx_t_33 = (__pyx_v_tForReversal - __pyx_v_t);
17700  __pyx_t_34 = (__pyx_v_tForReversal - 0.0);
17701  if (unlikely(__pyx_t_34 == 0)) {
17702  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
17703  __PYX_ERR(0, 835, __pyx_L1_error)
17704  }
17705  __pyx_t_30 = PyFloat_FromDouble(((__pyx_t_33 / __pyx_t_34) * __pyx_v_clock)); if (unlikely(!__pyx_t_30)) __PYX_ERR(0, 835, __pyx_L1_error)
17706  __Pyx_GOTREF(__pyx_t_30);
17707  __pyx_t_29 = PyNumber_InPlaceMultiply(__pyx_t_31, __pyx_t_30); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 835, __pyx_L1_error)
17708  __Pyx_GOTREF(__pyx_t_29);
17709  __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
17710  __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
17711  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_32, __pyx_t_29) < 0)) __PYX_ERR(0, 835, __pyx_L1_error)
17712  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
17713  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
17714  }
17715  }
17716  }
17717 
17718  /* "subsurfaceTransportFunctions.pyx":828
17719  * pi = M_PI
17720  * if v.shape[-1] == 3:
17721  * if transient == 1: # <<<<<<<<<<<<<<
17722  * for eN in range(x.shape[0]):
17723  * for ebN in range(x.shape[1]):
17724  */
17725  goto __pyx_L4;
17726  }
17727 
17728  /* "subsurfaceTransportFunctions.pyx":837
17729  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17730  * else:
17731  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
17732  * for ebN in range(x.shape[1]):
17733  * for k in range(x.shape[2]):
17734  */
17735  /*else*/ {
17736  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
17737  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
17738  __pyx_v_eN = __pyx_t_3;
17739 
17740  /* "subsurfaceTransportFunctions.pyx":838
17741  * else:
17742  * for eN in range(x.shape[0]):
17743  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
17744  * for k in range(x.shape[2]):
17745  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
17746  */
17747  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
17748  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
17749  __pyx_v_ebN = __pyx_t_5;
17750 
17751  /* "subsurfaceTransportFunctions.pyx":839
17752  * for eN in range(x.shape[0]):
17753  * for ebN in range(x.shape[1]):
17754  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
17755  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
17756  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
17757  */
17758  __pyx_t_6 = (__pyx_v_x->dimensions[2]);
17759  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
17760  __pyx_v_k = __pyx_t_7;
17761 
17762  /* "subsurfaceTransportFunctions.pyx":840
17763  * for ebN in range(x.shape[1]):
17764  * for k in range(x.shape[2]):
17765  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
17766  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
17767  * v[eN,ebN,k,2]=zvelocity
17768  */
17769  __pyx_t_35 = __pyx_v_eN;
17770  __pyx_t_36 = __pyx_v_ebN;
17771  __pyx_t_37 = __pyx_v_k;
17772  __pyx_t_38 = 1;
17773  __pyx_t_12 = -1;
17774  if (__pyx_t_35 < 0) {
17775  __pyx_t_35 += __pyx_pybuffernd_x.diminfo[0].shape;
17776  if (unlikely(__pyx_t_35 < 0)) __pyx_t_12 = 0;
17777  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_12 = 0;
17778  if (__pyx_t_36 < 0) {
17779  __pyx_t_36 += __pyx_pybuffernd_x.diminfo[1].shape;
17780  if (unlikely(__pyx_t_36 < 0)) __pyx_t_12 = 1;
17781  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_12 = 1;
17782  if (__pyx_t_37 < 0) {
17783  __pyx_t_37 += __pyx_pybuffernd_x.diminfo[2].shape;
17784  if (unlikely(__pyx_t_37 < 0)) __pyx_t_12 = 2;
17785  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_12 = 2;
17786  if (__pyx_t_38 < 0) {
17787  __pyx_t_38 += __pyx_pybuffernd_x.diminfo[3].shape;
17788  if (unlikely(__pyx_t_38 < 0)) __pyx_t_12 = 3;
17789  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_12 = 3;
17790  if (unlikely(__pyx_t_12 != -1)) {
17791  __Pyx_RaiseBufferIndexError(__pyx_t_12);
17792  __PYX_ERR(0, 840, __pyx_L1_error)
17793  }
17794  __pyx_t_39 = __pyx_v_eN;
17795  __pyx_t_40 = __pyx_v_ebN;
17796  __pyx_t_41 = __pyx_v_k;
17797  __pyx_t_42 = 0;
17798  __pyx_t_12 = -1;
17799  if (__pyx_t_39 < 0) {
17800  __pyx_t_39 += __pyx_pybuffernd_v.diminfo[0].shape;
17801  if (unlikely(__pyx_t_39 < 0)) __pyx_t_12 = 0;
17802  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
17803  if (__pyx_t_40 < 0) {
17804  __pyx_t_40 += __pyx_pybuffernd_v.diminfo[1].shape;
17805  if (unlikely(__pyx_t_40 < 0)) __pyx_t_12 = 1;
17806  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
17807  if (__pyx_t_41 < 0) {
17808  __pyx_t_41 += __pyx_pybuffernd_v.diminfo[2].shape;
17809  if (unlikely(__pyx_t_41 < 0)) __pyx_t_12 = 2;
17810  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
17811  if (__pyx_t_42 < 0) {
17812  __pyx_t_42 += __pyx_pybuffernd_v.diminfo[3].shape;
17813  if (unlikely(__pyx_t_42 < 0)) __pyx_t_12 = 3;
17814  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
17815  if (unlikely(__pyx_t_12 != -1)) {
17816  __Pyx_RaiseBufferIndexError(__pyx_t_12);
17817  __PYX_ERR(0, 840, __pyx_L1_error)
17818  }
17819  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_41, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_42, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_36, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_37, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_38, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
17820 
17821  /* "subsurfaceTransportFunctions.pyx":841
17822  * for k in range(x.shape[2]):
17823  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
17824  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
17825  * v[eN,ebN,k,2]=zvelocity
17826  * else:
17827  */
17828  __pyx_t_43 = __pyx_v_eN;
17829  __pyx_t_44 = __pyx_v_ebN;
17830  __pyx_t_45 = __pyx_v_k;
17831  __pyx_t_46 = 0;
17832  __pyx_t_12 = -1;
17833  if (__pyx_t_43 < 0) {
17834  __pyx_t_43 += __pyx_pybuffernd_x.diminfo[0].shape;
17835  if (unlikely(__pyx_t_43 < 0)) __pyx_t_12 = 0;
17836  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_12 = 0;
17837  if (__pyx_t_44 < 0) {
17838  __pyx_t_44 += __pyx_pybuffernd_x.diminfo[1].shape;
17839  if (unlikely(__pyx_t_44 < 0)) __pyx_t_12 = 1;
17840  } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_12 = 1;
17841  if (__pyx_t_45 < 0) {
17842  __pyx_t_45 += __pyx_pybuffernd_x.diminfo[2].shape;
17843  if (unlikely(__pyx_t_45 < 0)) __pyx_t_12 = 2;
17844  } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_12 = 2;
17845  if (__pyx_t_46 < 0) {
17846  __pyx_t_46 += __pyx_pybuffernd_x.diminfo[3].shape;
17847  if (unlikely(__pyx_t_46 < 0)) __pyx_t_12 = 3;
17848  } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_12 = 3;
17849  if (unlikely(__pyx_t_12 != -1)) {
17850  __Pyx_RaiseBufferIndexError(__pyx_t_12);
17851  __PYX_ERR(0, 841, __pyx_L1_error)
17852  }
17853  __pyx_t_47 = __pyx_v_eN;
17854  __pyx_t_48 = __pyx_v_ebN;
17855  __pyx_t_49 = __pyx_v_k;
17856  __pyx_t_50 = 1;
17857  __pyx_t_12 = -1;
17858  if (__pyx_t_47 < 0) {
17859  __pyx_t_47 += __pyx_pybuffernd_v.diminfo[0].shape;
17860  if (unlikely(__pyx_t_47 < 0)) __pyx_t_12 = 0;
17861  } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
17862  if (__pyx_t_48 < 0) {
17863  __pyx_t_48 += __pyx_pybuffernd_v.diminfo[1].shape;
17864  if (unlikely(__pyx_t_48 < 0)) __pyx_t_12 = 1;
17865  } else if (unlikely(__pyx_t_48 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
17866  if (__pyx_t_49 < 0) {
17867  __pyx_t_49 += __pyx_pybuffernd_v.diminfo[2].shape;
17868  if (unlikely(__pyx_t_49 < 0)) __pyx_t_12 = 2;
17869  } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
17870  if (__pyx_t_50 < 0) {
17871  __pyx_t_50 += __pyx_pybuffernd_v.diminfo[3].shape;
17872  if (unlikely(__pyx_t_50 < 0)) __pyx_t_12 = 3;
17873  } else if (unlikely(__pyx_t_50 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
17874  if (unlikely(__pyx_t_12 != -1)) {
17875  __Pyx_RaiseBufferIndexError(__pyx_t_12);
17876  __PYX_ERR(0, 841, __pyx_L1_error)
17877  }
17878  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_48, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_49, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_50, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_44, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_45, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_46, __pyx_pybuffernd_x.diminfo[3].strides))));
17879 
17880  /* "subsurfaceTransportFunctions.pyx":842
17881  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
17882  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
17883  * v[eN,ebN,k,2]=zvelocity # <<<<<<<<<<<<<<
17884  * else:
17885  * assert v.shape[-1] == 2
17886  */
17887  __pyx_t_51 = __pyx_v_eN;
17888  __pyx_t_52 = __pyx_v_ebN;
17889  __pyx_t_53 = __pyx_v_k;
17890  __pyx_t_54 = 2;
17891  __pyx_t_12 = -1;
17892  if (__pyx_t_51 < 0) {
17893  __pyx_t_51 += __pyx_pybuffernd_v.diminfo[0].shape;
17894  if (unlikely(__pyx_t_51 < 0)) __pyx_t_12 = 0;
17895  } else if (unlikely(__pyx_t_51 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
17896  if (__pyx_t_52 < 0) {
17897  __pyx_t_52 += __pyx_pybuffernd_v.diminfo[1].shape;
17898  if (unlikely(__pyx_t_52 < 0)) __pyx_t_12 = 1;
17899  } else if (unlikely(__pyx_t_52 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
17900  if (__pyx_t_53 < 0) {
17901  __pyx_t_53 += __pyx_pybuffernd_v.diminfo[2].shape;
17902  if (unlikely(__pyx_t_53 < 0)) __pyx_t_12 = 2;
17903  } else if (unlikely(__pyx_t_53 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
17904  if (__pyx_t_54 < 0) {
17905  __pyx_t_54 += __pyx_pybuffernd_v.diminfo[3].shape;
17906  if (unlikely(__pyx_t_54 < 0)) __pyx_t_12 = 3;
17907  } else if (unlikely(__pyx_t_54 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
17908  if (unlikely(__pyx_t_12 != -1)) {
17909  __Pyx_RaiseBufferIndexError(__pyx_t_12);
17910  __PYX_ERR(0, 842, __pyx_L1_error)
17911  }
17912  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_52, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_53, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_54, __pyx_pybuffernd_v.diminfo[3].strides) = __pyx_v_zvelocity;
17913  }
17914  }
17915  }
17916  }
17917  __pyx_L4:;
17918 
17919  /* "subsurfaceTransportFunctions.pyx":827
17920  * cdef double pi
17921  * pi = M_PI
17922  * if v.shape[-1] == 3: # <<<<<<<<<<<<<<
17923  * if transient == 1:
17924  * for eN in range(x.shape[0]):
17925  */
17926  goto __pyx_L3;
17927  }
17928 
17929  /* "subsurfaceTransportFunctions.pyx":844
17930  * v[eN,ebN,k,2]=zvelocity
17931  * else:
17932  * assert v.shape[-1] == 2 # <<<<<<<<<<<<<<
17933  * if transient == 1:
17934  * for eN in range(x.shape[0]):
17935  */
17936  /*else*/ {
17937  #ifndef CYTHON_WITHOUT_ASSERTIONS
17938  if (unlikely(!Py_OptimizeFlag)) {
17939  if (unlikely(!(((__pyx_v_v->dimensions[-1L]) == 2) != 0))) {
17940  PyErr_SetNone(PyExc_AssertionError);
17941  __PYX_ERR(0, 844, __pyx_L1_error)
17942  }
17943  }
17944  #endif
17945 
17946  /* "subsurfaceTransportFunctions.pyx":845
17947  * else:
17948  * assert v.shape[-1] == 2
17949  * if transient == 1: # <<<<<<<<<<<<<<
17950  * for eN in range(x.shape[0]):
17951  * for ebN in range(x.shape[1]):
17952  */
17953  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
17954  if (__pyx_t_1) {
17955 
17956  /* "subsurfaceTransportFunctions.pyx":846
17957  * assert v.shape[-1] == 2
17958  * if transient == 1:
17959  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
17960  * for ebN in range(x.shape[1]):
17961  * for k in range(x.shape[2]):
17962  */
17963  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
17964  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
17965  __pyx_v_eN = __pyx_t_3;
17966 
17967  /* "subsurfaceTransportFunctions.pyx":847
17968  * if transient == 1:
17969  * for eN in range(x.shape[0]):
17970  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
17971  * for k in range(x.shape[2]):
17972  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
17973  */
17974  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
17975  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
17976  __pyx_v_ebN = __pyx_t_5;
17977 
17978  /* "subsurfaceTransportFunctions.pyx":848
17979  * for eN in range(x.shape[0]):
17980  * for ebN in range(x.shape[1]):
17981  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
17982  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
17983  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
17984  */
17985  __pyx_t_6 = (__pyx_v_x->dimensions[2]);
17986  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
17987  __pyx_v_k = __pyx_t_7;
17988 
17989  /* "subsurfaceTransportFunctions.pyx":849
17990  * for ebN in range(x.shape[1]):
17991  * for k in range(x.shape[2]):
17992  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
17993  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
17994  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17995  */
17996  __pyx_t_55 = __pyx_v_eN;
17997  __pyx_t_56 = __pyx_v_ebN;
17998  __pyx_t_57 = __pyx_v_k;
17999  __pyx_t_58 = 1;
18000  __pyx_t_12 = -1;
18001  if (__pyx_t_55 < 0) {
18002  __pyx_t_55 += __pyx_pybuffernd_x.diminfo[0].shape;
18003  if (unlikely(__pyx_t_55 < 0)) __pyx_t_12 = 0;
18004  } else if (unlikely(__pyx_t_55 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_12 = 0;
18005  if (__pyx_t_56 < 0) {
18006  __pyx_t_56 += __pyx_pybuffernd_x.diminfo[1].shape;
18007  if (unlikely(__pyx_t_56 < 0)) __pyx_t_12 = 1;
18008  } else if (unlikely(__pyx_t_56 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_12 = 1;
18009  if (__pyx_t_57 < 0) {
18010  __pyx_t_57 += __pyx_pybuffernd_x.diminfo[2].shape;
18011  if (unlikely(__pyx_t_57 < 0)) __pyx_t_12 = 2;
18012  } else if (unlikely(__pyx_t_57 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_12 = 2;
18013  if (__pyx_t_58 < 0) {
18014  __pyx_t_58 += __pyx_pybuffernd_x.diminfo[3].shape;
18015  if (unlikely(__pyx_t_58 < 0)) __pyx_t_12 = 3;
18016  } else if (unlikely(__pyx_t_58 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_12 = 3;
18017  if (unlikely(__pyx_t_12 != -1)) {
18018  __Pyx_RaiseBufferIndexError(__pyx_t_12);
18019  __PYX_ERR(0, 849, __pyx_L1_error)
18020  }
18021  __pyx_t_59 = __pyx_v_eN;
18022  __pyx_t_60 = __pyx_v_ebN;
18023  __pyx_t_61 = __pyx_v_k;
18024  __pyx_t_62 = 0;
18025  __pyx_t_12 = -1;
18026  if (__pyx_t_59 < 0) {
18027  __pyx_t_59 += __pyx_pybuffernd_v.diminfo[0].shape;
18028  if (unlikely(__pyx_t_59 < 0)) __pyx_t_12 = 0;
18029  } else if (unlikely(__pyx_t_59 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
18030  if (__pyx_t_60 < 0) {
18031  __pyx_t_60 += __pyx_pybuffernd_v.diminfo[1].shape;
18032  if (unlikely(__pyx_t_60 < 0)) __pyx_t_12 = 1;
18033  } else if (unlikely(__pyx_t_60 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
18034  if (__pyx_t_61 < 0) {
18035  __pyx_t_61 += __pyx_pybuffernd_v.diminfo[2].shape;
18036  if (unlikely(__pyx_t_61 < 0)) __pyx_t_12 = 2;
18037  } else if (unlikely(__pyx_t_61 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
18038  if (__pyx_t_62 < 0) {
18039  __pyx_t_62 += __pyx_pybuffernd_v.diminfo[3].shape;
18040  if (unlikely(__pyx_t_62 < 0)) __pyx_t_12 = 3;
18041  } else if (unlikely(__pyx_t_62 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
18042  if (unlikely(__pyx_t_12 != -1)) {
18043  __Pyx_RaiseBufferIndexError(__pyx_t_12);
18044  __PYX_ERR(0, 849, __pyx_L1_error)
18045  }
18046  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_59, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_60, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_61, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_62, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_56, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_57, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_58, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
18047 
18048  /* "subsurfaceTransportFunctions.pyx":850
18049  * for k in range(x.shape[2]):
18050  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18051  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
18052  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18053  * else:
18054  */
18055  __pyx_t_63 = __pyx_v_eN;
18056  __pyx_t_64 = __pyx_v_ebN;
18057  __pyx_t_65 = __pyx_v_k;
18058  __pyx_t_66 = 0;
18059  __pyx_t_12 = -1;
18060  if (__pyx_t_63 < 0) {
18061  __pyx_t_63 += __pyx_pybuffernd_x.diminfo[0].shape;
18062  if (unlikely(__pyx_t_63 < 0)) __pyx_t_12 = 0;
18063  } else if (unlikely(__pyx_t_63 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_12 = 0;
18064  if (__pyx_t_64 < 0) {
18065  __pyx_t_64 += __pyx_pybuffernd_x.diminfo[1].shape;
18066  if (unlikely(__pyx_t_64 < 0)) __pyx_t_12 = 1;
18067  } else if (unlikely(__pyx_t_64 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_12 = 1;
18068  if (__pyx_t_65 < 0) {
18069  __pyx_t_65 += __pyx_pybuffernd_x.diminfo[2].shape;
18070  if (unlikely(__pyx_t_65 < 0)) __pyx_t_12 = 2;
18071  } else if (unlikely(__pyx_t_65 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_12 = 2;
18072  if (__pyx_t_66 < 0) {
18073  __pyx_t_66 += __pyx_pybuffernd_x.diminfo[3].shape;
18074  if (unlikely(__pyx_t_66 < 0)) __pyx_t_12 = 3;
18075  } else if (unlikely(__pyx_t_66 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_12 = 3;
18076  if (unlikely(__pyx_t_12 != -1)) {
18077  __Pyx_RaiseBufferIndexError(__pyx_t_12);
18078  __PYX_ERR(0, 850, __pyx_L1_error)
18079  }
18080  __pyx_t_67 = __pyx_v_eN;
18081  __pyx_t_68 = __pyx_v_ebN;
18082  __pyx_t_69 = __pyx_v_k;
18083  __pyx_t_70 = 1;
18084  __pyx_t_12 = -1;
18085  if (__pyx_t_67 < 0) {
18086  __pyx_t_67 += __pyx_pybuffernd_v.diminfo[0].shape;
18087  if (unlikely(__pyx_t_67 < 0)) __pyx_t_12 = 0;
18088  } else if (unlikely(__pyx_t_67 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
18089  if (__pyx_t_68 < 0) {
18090  __pyx_t_68 += __pyx_pybuffernd_v.diminfo[1].shape;
18091  if (unlikely(__pyx_t_68 < 0)) __pyx_t_12 = 1;
18092  } else if (unlikely(__pyx_t_68 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
18093  if (__pyx_t_69 < 0) {
18094  __pyx_t_69 += __pyx_pybuffernd_v.diminfo[2].shape;
18095  if (unlikely(__pyx_t_69 < 0)) __pyx_t_12 = 2;
18096  } else if (unlikely(__pyx_t_69 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
18097  if (__pyx_t_70 < 0) {
18098  __pyx_t_70 += __pyx_pybuffernd_v.diminfo[3].shape;
18099  if (unlikely(__pyx_t_70 < 0)) __pyx_t_12 = 3;
18100  } else if (unlikely(__pyx_t_70 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
18101  if (unlikely(__pyx_t_12 != -1)) {
18102  __Pyx_RaiseBufferIndexError(__pyx_t_12);
18103  __PYX_ERR(0, 850, __pyx_L1_error)
18104  }
18105  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_67, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_68, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_69, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_70, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_63, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_64, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_65, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_66, __pyx_pybuffernd_x.diminfo[3].strides))));
18106 
18107  /* "subsurfaceTransportFunctions.pyx":851
18108  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18109  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18110  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
18111  * else:
18112  * for eN in range(x.shape[0]):
18113  */
18114  __pyx_t_32 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_32)) __PYX_ERR(0, 851, __pyx_L1_error)
18115  __Pyx_GOTREF(__pyx_t_32);
18116  __pyx_t_29 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 851, __pyx_L1_error)
18117  __Pyx_GOTREF(__pyx_t_29);
18118  __pyx_t_30 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_30)) __PYX_ERR(0, 851, __pyx_L1_error)
18119  __Pyx_GOTREF(__pyx_t_30);
18120  __pyx_t_31 = PyTuple_New(4); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 851, __pyx_L1_error)
18121  __Pyx_GOTREF(__pyx_t_31);
18122  __Pyx_GIVEREF(__pyx_t_32);
18123  PyTuple_SET_ITEM(__pyx_t_31, 0, __pyx_t_32);
18124  __Pyx_GIVEREF(__pyx_t_29);
18125  PyTuple_SET_ITEM(__pyx_t_31, 1, __pyx_t_29);
18126  __Pyx_GIVEREF(__pyx_t_30);
18127  PyTuple_SET_ITEM(__pyx_t_31, 2, __pyx_t_30);
18128  __Pyx_INCREF(__pyx_slice__6);
18129  __Pyx_GIVEREF(__pyx_slice__6);
18130  PyTuple_SET_ITEM(__pyx_t_31, 3, __pyx_slice__6);
18131  __pyx_t_32 = 0;
18132  __pyx_t_29 = 0;
18133  __pyx_t_30 = 0;
18134  __pyx_t_30 = PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_31); if (unlikely(!__pyx_t_30)) __PYX_ERR(0, 851, __pyx_L1_error)
18135  __Pyx_GOTREF(__pyx_t_30);
18136  __pyx_t_34 = (__pyx_v_tForReversal - __pyx_v_t);
18137  __pyx_t_33 = (__pyx_v_tForReversal - 0.0);
18138  if (unlikely(__pyx_t_33 == 0)) {
18139  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
18140  __PYX_ERR(0, 851, __pyx_L1_error)
18141  }
18142  __pyx_t_29 = PyFloat_FromDouble(((__pyx_t_34 / __pyx_t_33) * __pyx_v_clock)); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 851, __pyx_L1_error)
18143  __Pyx_GOTREF(__pyx_t_29);
18144  __pyx_t_32 = PyNumber_InPlaceMultiply(__pyx_t_30, __pyx_t_29); if (unlikely(!__pyx_t_32)) __PYX_ERR(0, 851, __pyx_L1_error)
18145  __Pyx_GOTREF(__pyx_t_32);
18146  __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
18147  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
18148  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_31, __pyx_t_32) < 0)) __PYX_ERR(0, 851, __pyx_L1_error)
18149  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
18150  __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
18151  }
18152  }
18153  }
18154 
18155  /* "subsurfaceTransportFunctions.pyx":845
18156  * else:
18157  * assert v.shape[-1] == 2
18158  * if transient == 1: # <<<<<<<<<<<<<<
18159  * for eN in range(x.shape[0]):
18160  * for ebN in range(x.shape[1]):
18161  */
18162  goto __pyx_L17;
18163  }
18164 
18165  /* "subsurfaceTransportFunctions.pyx":853
18166  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18167  * else:
18168  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
18169  * for ebN in range(x.shape[1]):
18170  * for k in range(x.shape[2]):
18171  */
18172  /*else*/ {
18173  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
18174  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
18175  __pyx_v_eN = __pyx_t_3;
18176 
18177  /* "subsurfaceTransportFunctions.pyx":854
18178  * else:
18179  * for eN in range(x.shape[0]):
18180  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
18181  * for k in range(x.shape[2]):
18182  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18183  */
18184  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
18185  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
18186  __pyx_v_ebN = __pyx_t_5;
18187 
18188  /* "subsurfaceTransportFunctions.pyx":855
18189  * for eN in range(x.shape[0]):
18190  * for ebN in range(x.shape[1]):
18191  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
18192  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18193  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18194  */
18195  __pyx_t_6 = (__pyx_v_x->dimensions[2]);
18196  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
18197  __pyx_v_k = __pyx_t_7;
18198 
18199  /* "subsurfaceTransportFunctions.pyx":856
18200  * for ebN in range(x.shape[1]):
18201  * for k in range(x.shape[2]):
18202  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
18203  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18204  *
18205  */
18206  __pyx_t_71 = __pyx_v_eN;
18207  __pyx_t_72 = __pyx_v_ebN;
18208  __pyx_t_73 = __pyx_v_k;
18209  __pyx_t_74 = 1;
18210  __pyx_t_12 = -1;
18211  if (__pyx_t_71 < 0) {
18212  __pyx_t_71 += __pyx_pybuffernd_x.diminfo[0].shape;
18213  if (unlikely(__pyx_t_71 < 0)) __pyx_t_12 = 0;
18214  } else if (unlikely(__pyx_t_71 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_12 = 0;
18215  if (__pyx_t_72 < 0) {
18216  __pyx_t_72 += __pyx_pybuffernd_x.diminfo[1].shape;
18217  if (unlikely(__pyx_t_72 < 0)) __pyx_t_12 = 1;
18218  } else if (unlikely(__pyx_t_72 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_12 = 1;
18219  if (__pyx_t_73 < 0) {
18220  __pyx_t_73 += __pyx_pybuffernd_x.diminfo[2].shape;
18221  if (unlikely(__pyx_t_73 < 0)) __pyx_t_12 = 2;
18222  } else if (unlikely(__pyx_t_73 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_12 = 2;
18223  if (__pyx_t_74 < 0) {
18224  __pyx_t_74 += __pyx_pybuffernd_x.diminfo[3].shape;
18225  if (unlikely(__pyx_t_74 < 0)) __pyx_t_12 = 3;
18226  } else if (unlikely(__pyx_t_74 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_12 = 3;
18227  if (unlikely(__pyx_t_12 != -1)) {
18228  __Pyx_RaiseBufferIndexError(__pyx_t_12);
18229  __PYX_ERR(0, 856, __pyx_L1_error)
18230  }
18231  __pyx_t_75 = __pyx_v_eN;
18232  __pyx_t_76 = __pyx_v_ebN;
18233  __pyx_t_77 = __pyx_v_k;
18234  __pyx_t_78 = 0;
18235  __pyx_t_12 = -1;
18236  if (__pyx_t_75 < 0) {
18237  __pyx_t_75 += __pyx_pybuffernd_v.diminfo[0].shape;
18238  if (unlikely(__pyx_t_75 < 0)) __pyx_t_12 = 0;
18239  } else if (unlikely(__pyx_t_75 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
18240  if (__pyx_t_76 < 0) {
18241  __pyx_t_76 += __pyx_pybuffernd_v.diminfo[1].shape;
18242  if (unlikely(__pyx_t_76 < 0)) __pyx_t_12 = 1;
18243  } else if (unlikely(__pyx_t_76 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
18244  if (__pyx_t_77 < 0) {
18245  __pyx_t_77 += __pyx_pybuffernd_v.diminfo[2].shape;
18246  if (unlikely(__pyx_t_77 < 0)) __pyx_t_12 = 2;
18247  } else if (unlikely(__pyx_t_77 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
18248  if (__pyx_t_78 < 0) {
18249  __pyx_t_78 += __pyx_pybuffernd_v.diminfo[3].shape;
18250  if (unlikely(__pyx_t_78 < 0)) __pyx_t_12 = 3;
18251  } else if (unlikely(__pyx_t_78 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
18252  if (unlikely(__pyx_t_12 != -1)) {
18253  __Pyx_RaiseBufferIndexError(__pyx_t_12);
18254  __PYX_ERR(0, 856, __pyx_L1_error)
18255  }
18256  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_75, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_76, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_77, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_78, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_71, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_72, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_73, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_74, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
18257 
18258  /* "subsurfaceTransportFunctions.pyx":857
18259  * for k in range(x.shape[2]):
18260  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18261  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
18262  *
18263  * def helicalElementVelocityEval3(int transient,
18264  */
18265  __pyx_t_79 = __pyx_v_eN;
18266  __pyx_t_80 = __pyx_v_ebN;
18267  __pyx_t_81 = __pyx_v_k;
18268  __pyx_t_82 = 0;
18269  __pyx_t_12 = -1;
18270  if (__pyx_t_79 < 0) {
18271  __pyx_t_79 += __pyx_pybuffernd_x.diminfo[0].shape;
18272  if (unlikely(__pyx_t_79 < 0)) __pyx_t_12 = 0;
18273  } else if (unlikely(__pyx_t_79 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_12 = 0;
18274  if (__pyx_t_80 < 0) {
18275  __pyx_t_80 += __pyx_pybuffernd_x.diminfo[1].shape;
18276  if (unlikely(__pyx_t_80 < 0)) __pyx_t_12 = 1;
18277  } else if (unlikely(__pyx_t_80 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_12 = 1;
18278  if (__pyx_t_81 < 0) {
18279  __pyx_t_81 += __pyx_pybuffernd_x.diminfo[2].shape;
18280  if (unlikely(__pyx_t_81 < 0)) __pyx_t_12 = 2;
18281  } else if (unlikely(__pyx_t_81 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_12 = 2;
18282  if (__pyx_t_82 < 0) {
18283  __pyx_t_82 += __pyx_pybuffernd_x.diminfo[3].shape;
18284  if (unlikely(__pyx_t_82 < 0)) __pyx_t_12 = 3;
18285  } else if (unlikely(__pyx_t_82 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_12 = 3;
18286  if (unlikely(__pyx_t_12 != -1)) {
18287  __Pyx_RaiseBufferIndexError(__pyx_t_12);
18288  __PYX_ERR(0, 857, __pyx_L1_error)
18289  }
18290  __pyx_t_83 = __pyx_v_eN;
18291  __pyx_t_84 = __pyx_v_ebN;
18292  __pyx_t_85 = __pyx_v_k;
18293  __pyx_t_86 = 1;
18294  __pyx_t_12 = -1;
18295  if (__pyx_t_83 < 0) {
18296  __pyx_t_83 += __pyx_pybuffernd_v.diminfo[0].shape;
18297  if (unlikely(__pyx_t_83 < 0)) __pyx_t_12 = 0;
18298  } else if (unlikely(__pyx_t_83 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
18299  if (__pyx_t_84 < 0) {
18300  __pyx_t_84 += __pyx_pybuffernd_v.diminfo[1].shape;
18301  if (unlikely(__pyx_t_84 < 0)) __pyx_t_12 = 1;
18302  } else if (unlikely(__pyx_t_84 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
18303  if (__pyx_t_85 < 0) {
18304  __pyx_t_85 += __pyx_pybuffernd_v.diminfo[2].shape;
18305  if (unlikely(__pyx_t_85 < 0)) __pyx_t_12 = 2;
18306  } else if (unlikely(__pyx_t_85 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
18307  if (__pyx_t_86 < 0) {
18308  __pyx_t_86 += __pyx_pybuffernd_v.diminfo[3].shape;
18309  if (unlikely(__pyx_t_86 < 0)) __pyx_t_12 = 3;
18310  } else if (unlikely(__pyx_t_86 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
18311  if (unlikely(__pyx_t_12 != -1)) {
18312  __Pyx_RaiseBufferIndexError(__pyx_t_12);
18313  __PYX_ERR(0, 857, __pyx_L1_error)
18314  }
18315  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_83, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_84, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_85, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_86, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_79, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_80, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_81, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_82, __pyx_pybuffernd_x.diminfo[3].strides))));
18316  }
18317  }
18318  }
18319  }
18320  __pyx_L17:;
18321  }
18322  __pyx_L3:;
18323 
18324  /* "subsurfaceTransportFunctions.pyx":816
18325  *
18326  *
18327  * def rotatingGaussianElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
18328  * double t,
18329  * double tForReversal,
18330  */
18331 
18332  /* function exit code */
18333  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
18334  goto __pyx_L0;
18335  __pyx_L1_error:;
18336  __Pyx_XDECREF(__pyx_t_29);
18337  __Pyx_XDECREF(__pyx_t_30);
18338  __Pyx_XDECREF(__pyx_t_31);
18339  __Pyx_XDECREF(__pyx_t_32);
18340  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
18341  __Pyx_PyThreadState_declare
18342  __Pyx_PyThreadState_assign
18343  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
18344  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
18345  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
18346  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
18347  __Pyx_AddTraceback("subsurfaceTransportFunctions.rotatingGaussianElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
18348  __pyx_r = NULL;
18349  goto __pyx_L2;
18350  __pyx_L0:;
18351  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
18352  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
18353  __pyx_L2:;
18354  __Pyx_XGIVEREF(__pyx_r);
18355  __Pyx_RefNannyFinishContext();
18356  return __pyx_r;
18357 }
18358 
18359 /* "subsurfaceTransportFunctions.pyx":859
18360  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18361  *
18362  * def helicalElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
18363  * double t,
18364  * double tForReversal,
18365  */
18366 
18367 /* Python wrapper */
18368 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_51helicalElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
18369 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_51helicalElementVelocityEval3 = {"helicalElementVelocityEval3", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_51helicalElementVelocityEval3, METH_VARARGS|METH_KEYWORDS, 0};
18370 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_51helicalElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
18371  int __pyx_v_transient;
18372  double __pyx_v_t;
18373  double __pyx_v_tForReversal;
18374  double __pyx_v_clock;
18375  double __pyx_v_zVelocity;
18376  double __pyx_v_xc;
18377  double __pyx_v_yc;
18378  PyArrayObject *__pyx_v_x = 0;
18379  PyArrayObject *__pyx_v_v = 0;
18380  PyObject *__pyx_r = 0;
18381  __Pyx_RefNannyDeclarations
18382  __Pyx_RefNannySetupContext("helicalElementVelocityEval3 (wrapper)", 0);
18383  {
18384  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transient,&__pyx_n_s_t,&__pyx_n_s_tForReversal,&__pyx_n_s_clock,&__pyx_n_s_zVelocity,&__pyx_n_s_xc,&__pyx_n_s_yc,&__pyx_n_s_x,&__pyx_n_s_v,0};
18385  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
18386  if (unlikely(__pyx_kwds)) {
18387  Py_ssize_t kw_args;
18388  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
18389  switch (pos_args) {
18390  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
18391  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
18392  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
18393  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
18394  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
18395  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
18396  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
18397  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
18398  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
18399  case 0: break;
18400  default: goto __pyx_L5_argtuple_error;
18401  }
18402  kw_args = PyDict_Size(__pyx_kwds);
18403  switch (pos_args) {
18404  case 0:
18405  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_transient)) != 0)) kw_args--;
18406  else goto __pyx_L5_argtuple_error;
18407  case 1:
18408  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
18409  else {
18410  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 1); __PYX_ERR(0, 859, __pyx_L3_error)
18411  }
18412  case 2:
18413  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tForReversal)) != 0)) kw_args--;
18414  else {
18415  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 2); __PYX_ERR(0, 859, __pyx_L3_error)
18416  }
18417  case 3:
18418  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_clock)) != 0)) kw_args--;
18419  else {
18420  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 3); __PYX_ERR(0, 859, __pyx_L3_error)
18421  }
18422  case 4:
18423  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_zVelocity)) != 0)) kw_args--;
18424  else {
18425  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 4); __PYX_ERR(0, 859, __pyx_L3_error)
18426  }
18427  case 5:
18428  if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xc)) != 0)) kw_args--;
18429  else {
18430  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 5); __PYX_ERR(0, 859, __pyx_L3_error)
18431  }
18432  case 6:
18433  if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_yc)) != 0)) kw_args--;
18434  else {
18435  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 6); __PYX_ERR(0, 859, __pyx_L3_error)
18436  }
18437  case 7:
18438  if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
18439  else {
18440  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 7); __PYX_ERR(0, 859, __pyx_L3_error)
18441  }
18442  case 8:
18443  if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
18444  else {
18445  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 8); __PYX_ERR(0, 859, __pyx_L3_error)
18446  }
18447  }
18448  if (unlikely(kw_args > 0)) {
18449  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "helicalElementVelocityEval3") < 0)) __PYX_ERR(0, 859, __pyx_L3_error)
18450  }
18451  } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
18452  goto __pyx_L5_argtuple_error;
18453  } else {
18454  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
18455  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
18456  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
18457  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
18458  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
18459  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
18460  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
18461  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
18462  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
18463  }
18464  __pyx_v_transient = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_transient == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 859, __pyx_L3_error)
18465  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 860, __pyx_L3_error)
18466  __pyx_v_tForReversal = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tForReversal == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 861, __pyx_L3_error)
18467  __pyx_v_clock = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_clock == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 862, __pyx_L3_error)
18468  __pyx_v_zVelocity = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_zVelocity == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 863, __pyx_L3_error)
18469  __pyx_v_xc = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_xc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 864, __pyx_L3_error)
18470  __pyx_v_yc = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_yc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 864, __pyx_L3_error)
18471  __pyx_v_x = ((PyArrayObject *)values[7]);
18472  __pyx_v_v = ((PyArrayObject *)values[8]);
18473  }
18474  goto __pyx_L4_argument_unpacking_done;
18475  __pyx_L5_argtuple_error:;
18476  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 859, __pyx_L3_error)
18477  __pyx_L3_error:;
18478  __Pyx_AddTraceback("subsurfaceTransportFunctions.helicalElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
18479  __Pyx_RefNannyFinishContext();
18480  return NULL;
18481  __pyx_L4_argument_unpacking_done:;
18482  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 865, __pyx_L1_error)
18483  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 866, __pyx_L1_error)
18484  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_50helicalElementVelocityEval3(__pyx_self, __pyx_v_transient, __pyx_v_t, __pyx_v_tForReversal, __pyx_v_clock, __pyx_v_zVelocity, __pyx_v_xc, __pyx_v_yc, __pyx_v_x, __pyx_v_v);
18485 
18486  /* function exit code */
18487  goto __pyx_L0;
18488  __pyx_L1_error:;
18489  __pyx_r = NULL;
18490  __pyx_L0:;
18491  __Pyx_RefNannyFinishContext();
18492  return __pyx_r;
18493 }
18494 
18495 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_50helicalElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_zVelocity, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v) {
18496  int __pyx_v_eN;
18497  int __pyx_v_k;
18498  double __pyx_v_pi;
18499  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
18500  __Pyx_Buffer __pyx_pybuffer_v;
18501  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
18502  __Pyx_Buffer __pyx_pybuffer_x;
18503  PyObject *__pyx_r = NULL;
18504  __Pyx_RefNannyDeclarations
18505  int __pyx_t_1;
18506  npy_intp __pyx_t_2;
18507  int __pyx_t_3;
18508  npy_intp __pyx_t_4;
18509  int __pyx_t_5;
18510  Py_ssize_t __pyx_t_6;
18511  Py_ssize_t __pyx_t_7;
18512  Py_ssize_t __pyx_t_8;
18513  int __pyx_t_9;
18514  Py_ssize_t __pyx_t_10;
18515  Py_ssize_t __pyx_t_11;
18516  Py_ssize_t __pyx_t_12;
18517  Py_ssize_t __pyx_t_13;
18518  Py_ssize_t __pyx_t_14;
18519  Py_ssize_t __pyx_t_15;
18520  Py_ssize_t __pyx_t_16;
18521  Py_ssize_t __pyx_t_17;
18522  Py_ssize_t __pyx_t_18;
18523  Py_ssize_t __pyx_t_19;
18524  Py_ssize_t __pyx_t_20;
18525  Py_ssize_t __pyx_t_21;
18526  PyObject *__pyx_t_22 = NULL;
18527  PyObject *__pyx_t_23 = NULL;
18528  PyObject *__pyx_t_24 = NULL;
18529  double __pyx_t_25;
18530  double __pyx_t_26;
18531  PyObject *__pyx_t_27 = NULL;
18532  Py_ssize_t __pyx_t_28;
18533  Py_ssize_t __pyx_t_29;
18534  Py_ssize_t __pyx_t_30;
18535  Py_ssize_t __pyx_t_31;
18536  Py_ssize_t __pyx_t_32;
18537  Py_ssize_t __pyx_t_33;
18538  Py_ssize_t __pyx_t_34;
18539  Py_ssize_t __pyx_t_35;
18540  Py_ssize_t __pyx_t_36;
18541  Py_ssize_t __pyx_t_37;
18542  Py_ssize_t __pyx_t_38;
18543  Py_ssize_t __pyx_t_39;
18544  Py_ssize_t __pyx_t_40;
18545  Py_ssize_t __pyx_t_41;
18546  Py_ssize_t __pyx_t_42;
18547  __Pyx_RefNannySetupContext("helicalElementVelocityEval3", 0);
18548  __pyx_pybuffer_x.pybuffer.buf = NULL;
18549  __pyx_pybuffer_x.refcount = 0;
18550  __pyx_pybuffernd_x.data = NULL;
18551  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
18552  __pyx_pybuffer_v.pybuffer.buf = NULL;
18553  __pyx_pybuffer_v.refcount = 0;
18554  __pyx_pybuffernd_v.data = NULL;
18555  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
18556  {
18557  __Pyx_BufFmt_StackElem __pyx_stack[1];
18558  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 859, __pyx_L1_error)
18559  }
18560  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
18561  {
18562  __Pyx_BufFmt_StackElem __pyx_stack[1];
18563  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 859, __pyx_L1_error)
18564  }
18565  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2];
18566 
18567  /* "subsurfaceTransportFunctions.pyx":869
18568  * cdef int eN,k
18569  * cdef double pi
18570  * pi = M_PI # <<<<<<<<<<<<<<
18571  * if transient == 1:
18572  * for eN in range(x.shape[0]):
18573  */
18574  __pyx_v_pi = M_PI;
18575 
18576  /* "subsurfaceTransportFunctions.pyx":870
18577  * cdef double pi
18578  * pi = M_PI
18579  * if transient == 1: # <<<<<<<<<<<<<<
18580  * for eN in range(x.shape[0]):
18581  * for k in range(x.shape[1]):
18582  */
18583  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
18584  if (__pyx_t_1) {
18585 
18586  /* "subsurfaceTransportFunctions.pyx":871
18587  * pi = M_PI
18588  * if transient == 1:
18589  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
18590  * for k in range(x.shape[1]):
18591  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
18592  */
18593  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
18594  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
18595  __pyx_v_eN = __pyx_t_3;
18596 
18597  /* "subsurfaceTransportFunctions.pyx":872
18598  * if transient == 1:
18599  * for eN in range(x.shape[0]):
18600  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
18601  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
18602  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
18603  */
18604  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
18605  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
18606  __pyx_v_k = __pyx_t_5;
18607 
18608  /* "subsurfaceTransportFunctions.pyx":873
18609  * for eN in range(x.shape[0]):
18610  * for k in range(x.shape[1]):
18611  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
18612  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
18613  * v[eN,k,2]=zVelocity
18614  */
18615  __pyx_t_6 = __pyx_v_eN;
18616  __pyx_t_7 = __pyx_v_k;
18617  __pyx_t_8 = 1;
18618  __pyx_t_9 = -1;
18619  if (__pyx_t_6 < 0) {
18620  __pyx_t_6 += __pyx_pybuffernd_x.diminfo[0].shape;
18621  if (unlikely(__pyx_t_6 < 0)) __pyx_t_9 = 0;
18622  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_9 = 0;
18623  if (__pyx_t_7 < 0) {
18624  __pyx_t_7 += __pyx_pybuffernd_x.diminfo[1].shape;
18625  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1;
18626  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_9 = 1;
18627  if (__pyx_t_8 < 0) {
18628  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[2].shape;
18629  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 2;
18630  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_9 = 2;
18631  if (unlikely(__pyx_t_9 != -1)) {
18632  __Pyx_RaiseBufferIndexError(__pyx_t_9);
18633  __PYX_ERR(0, 873, __pyx_L1_error)
18634  }
18635  __pyx_t_10 = __pyx_v_eN;
18636  __pyx_t_11 = __pyx_v_k;
18637  __pyx_t_12 = 0;
18638  __pyx_t_9 = -1;
18639  if (__pyx_t_10 < 0) {
18640  __pyx_t_10 += __pyx_pybuffernd_v.diminfo[0].shape;
18641  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
18642  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
18643  if (__pyx_t_11 < 0) {
18644  __pyx_t_11 += __pyx_pybuffernd_v.diminfo[1].shape;
18645  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
18646  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
18647  if (__pyx_t_12 < 0) {
18648  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[2].shape;
18649  if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 2;
18650  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
18651  if (unlikely(__pyx_t_9 != -1)) {
18652  __Pyx_RaiseBufferIndexError(__pyx_t_9);
18653  __PYX_ERR(0, 873, __pyx_L1_error)
18654  }
18655  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
18656 
18657  /* "subsurfaceTransportFunctions.pyx":874
18658  * for k in range(x.shape[1]):
18659  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
18660  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
18661  * v[eN,k,2]=zVelocity
18662  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
18663  */
18664  __pyx_t_13 = __pyx_v_eN;
18665  __pyx_t_14 = __pyx_v_k;
18666  __pyx_t_15 = 0;
18667  __pyx_t_9 = -1;
18668  if (__pyx_t_13 < 0) {
18669  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[0].shape;
18670  if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 0;
18671  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_9 = 0;
18672  if (__pyx_t_14 < 0) {
18673  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[1].shape;
18674  if (unlikely(__pyx_t_14 < 0)) __pyx_t_9 = 1;
18675  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_9 = 1;
18676  if (__pyx_t_15 < 0) {
18677  __pyx_t_15 += __pyx_pybuffernd_x.diminfo[2].shape;
18678  if (unlikely(__pyx_t_15 < 0)) __pyx_t_9 = 2;
18679  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_9 = 2;
18680  if (unlikely(__pyx_t_9 != -1)) {
18681  __Pyx_RaiseBufferIndexError(__pyx_t_9);
18682  __PYX_ERR(0, 874, __pyx_L1_error)
18683  }
18684  __pyx_t_16 = __pyx_v_eN;
18685  __pyx_t_17 = __pyx_v_k;
18686  __pyx_t_18 = 1;
18687  __pyx_t_9 = -1;
18688  if (__pyx_t_16 < 0) {
18689  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[0].shape;
18690  if (unlikely(__pyx_t_16 < 0)) __pyx_t_9 = 0;
18691  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
18692  if (__pyx_t_17 < 0) {
18693  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[1].shape;
18694  if (unlikely(__pyx_t_17 < 0)) __pyx_t_9 = 1;
18695  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
18696  if (__pyx_t_18 < 0) {
18697  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[2].shape;
18698  if (unlikely(__pyx_t_18 < 0)) __pyx_t_9 = 2;
18699  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
18700  if (unlikely(__pyx_t_9 != -1)) {
18701  __Pyx_RaiseBufferIndexError(__pyx_t_9);
18702  __PYX_ERR(0, 874, __pyx_L1_error)
18703  }
18704  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_15, __pyx_pybuffernd_x.diminfo[2].strides))));
18705 
18706  /* "subsurfaceTransportFunctions.pyx":875
18707  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
18708  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
18709  * v[eN,k,2]=zVelocity # <<<<<<<<<<<<<<
18710  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
18711  * else:
18712  */
18713  __pyx_t_19 = __pyx_v_eN;
18714  __pyx_t_20 = __pyx_v_k;
18715  __pyx_t_21 = 2;
18716  __pyx_t_9 = -1;
18717  if (__pyx_t_19 < 0) {
18718  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[0].shape;
18719  if (unlikely(__pyx_t_19 < 0)) __pyx_t_9 = 0;
18720  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
18721  if (__pyx_t_20 < 0) {
18722  __pyx_t_20 += __pyx_pybuffernd_v.diminfo[1].shape;
18723  if (unlikely(__pyx_t_20 < 0)) __pyx_t_9 = 1;
18724  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
18725  if (__pyx_t_21 < 0) {
18726  __pyx_t_21 += __pyx_pybuffernd_v.diminfo[2].shape;
18727  if (unlikely(__pyx_t_21 < 0)) __pyx_t_9 = 2;
18728  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
18729  if (unlikely(__pyx_t_9 != -1)) {
18730  __Pyx_RaiseBufferIndexError(__pyx_t_9);
18731  __PYX_ERR(0, 875, __pyx_L1_error)
18732  }
18733  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_21, __pyx_pybuffernd_v.diminfo[2].strides) = __pyx_v_zVelocity;
18734 
18735  /* "subsurfaceTransportFunctions.pyx":876
18736  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
18737  * v[eN,k,2]=zVelocity
18738  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0)) # <<<<<<<<<<<<<<
18739  * else:
18740  * for eN in range(x.shape[0]):
18741  */
18742  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 876, __pyx_L1_error)
18743  __Pyx_GOTREF(__pyx_t_22);
18744  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 876, __pyx_L1_error)
18745  __Pyx_GOTREF(__pyx_t_23);
18746  __pyx_t_24 = PyTuple_New(3); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 876, __pyx_L1_error)
18747  __Pyx_GOTREF(__pyx_t_24);
18748  __Pyx_GIVEREF(__pyx_t_22);
18749  PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_22);
18750  __Pyx_GIVEREF(__pyx_t_23);
18751  PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_23);
18752  __Pyx_INCREF(__pyx_slice__7);
18753  __Pyx_GIVEREF(__pyx_slice__7);
18754  PyTuple_SET_ITEM(__pyx_t_24, 2, __pyx_slice__7);
18755  __pyx_t_22 = 0;
18756  __pyx_t_23 = 0;
18757  __pyx_t_23 = PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_24); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 876, __pyx_L1_error)
18758  __Pyx_GOTREF(__pyx_t_23);
18759  __pyx_t_25 = (__pyx_v_pi * __pyx_v_t);
18760  __pyx_t_26 = (__pyx_v_tForReversal * 2.0);
18761  if (unlikely(__pyx_t_26 == 0)) {
18762  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
18763  __PYX_ERR(0, 876, __pyx_L1_error)
18764  }
18765  __pyx_t_22 = PyFloat_FromDouble((__pyx_v_clock * cos((__pyx_t_25 / __pyx_t_26)))); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 876, __pyx_L1_error)
18766  __Pyx_GOTREF(__pyx_t_22);
18767  __pyx_t_27 = PyNumber_InPlaceMultiply(__pyx_t_23, __pyx_t_22); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 876, __pyx_L1_error)
18768  __Pyx_GOTREF(__pyx_t_27);
18769  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
18770  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
18771  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_24, __pyx_t_27) < 0)) __PYX_ERR(0, 876, __pyx_L1_error)
18772  __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
18773  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
18774  }
18775  }
18776 
18777  /* "subsurfaceTransportFunctions.pyx":870
18778  * cdef double pi
18779  * pi = M_PI
18780  * if transient == 1: # <<<<<<<<<<<<<<
18781  * for eN in range(x.shape[0]):
18782  * for k in range(x.shape[1]):
18783  */
18784  goto __pyx_L3;
18785  }
18786 
18787  /* "subsurfaceTransportFunctions.pyx":878
18788  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
18789  * else:
18790  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
18791  * for k in range(x.shape[1]):
18792  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
18793  */
18794  /*else*/ {
18795  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
18796  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
18797  __pyx_v_eN = __pyx_t_3;
18798 
18799  /* "subsurfaceTransportFunctions.pyx":879
18800  * else:
18801  * for eN in range(x.shape[0]):
18802  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
18803  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
18804  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
18805  */
18806  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
18807  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
18808  __pyx_v_k = __pyx_t_5;
18809 
18810  /* "subsurfaceTransportFunctions.pyx":880
18811  * for eN in range(x.shape[0]):
18812  * for k in range(x.shape[1]):
18813  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
18814  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
18815  * v[eN,k,2]=zVelocity
18816  */
18817  __pyx_t_28 = __pyx_v_eN;
18818  __pyx_t_29 = __pyx_v_k;
18819  __pyx_t_30 = 1;
18820  __pyx_t_9 = -1;
18821  if (__pyx_t_28 < 0) {
18822  __pyx_t_28 += __pyx_pybuffernd_x.diminfo[0].shape;
18823  if (unlikely(__pyx_t_28 < 0)) __pyx_t_9 = 0;
18824  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_9 = 0;
18825  if (__pyx_t_29 < 0) {
18826  __pyx_t_29 += __pyx_pybuffernd_x.diminfo[1].shape;
18827  if (unlikely(__pyx_t_29 < 0)) __pyx_t_9 = 1;
18828  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_9 = 1;
18829  if (__pyx_t_30 < 0) {
18830  __pyx_t_30 += __pyx_pybuffernd_x.diminfo[2].shape;
18831  if (unlikely(__pyx_t_30 < 0)) __pyx_t_9 = 2;
18832  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_9 = 2;
18833  if (unlikely(__pyx_t_9 != -1)) {
18834  __Pyx_RaiseBufferIndexError(__pyx_t_9);
18835  __PYX_ERR(0, 880, __pyx_L1_error)
18836  }
18837  __pyx_t_31 = __pyx_v_eN;
18838  __pyx_t_32 = __pyx_v_k;
18839  __pyx_t_33 = 0;
18840  __pyx_t_9 = -1;
18841  if (__pyx_t_31 < 0) {
18842  __pyx_t_31 += __pyx_pybuffernd_v.diminfo[0].shape;
18843  if (unlikely(__pyx_t_31 < 0)) __pyx_t_9 = 0;
18844  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
18845  if (__pyx_t_32 < 0) {
18846  __pyx_t_32 += __pyx_pybuffernd_v.diminfo[1].shape;
18847  if (unlikely(__pyx_t_32 < 0)) __pyx_t_9 = 1;
18848  } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
18849  if (__pyx_t_33 < 0) {
18850  __pyx_t_33 += __pyx_pybuffernd_v.diminfo[2].shape;
18851  if (unlikely(__pyx_t_33 < 0)) __pyx_t_9 = 2;
18852  } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
18853  if (unlikely(__pyx_t_9 != -1)) {
18854  __Pyx_RaiseBufferIndexError(__pyx_t_9);
18855  __PYX_ERR(0, 880, __pyx_L1_error)
18856  }
18857  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_33, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_30, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
18858 
18859  /* "subsurfaceTransportFunctions.pyx":881
18860  * for k in range(x.shape[1]):
18861  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
18862  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
18863  * v[eN,k,2]=zVelocity
18864  *
18865  */
18866  __pyx_t_34 = __pyx_v_eN;
18867  __pyx_t_35 = __pyx_v_k;
18868  __pyx_t_36 = 0;
18869  __pyx_t_9 = -1;
18870  if (__pyx_t_34 < 0) {
18871  __pyx_t_34 += __pyx_pybuffernd_x.diminfo[0].shape;
18872  if (unlikely(__pyx_t_34 < 0)) __pyx_t_9 = 0;
18873  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_9 = 0;
18874  if (__pyx_t_35 < 0) {
18875  __pyx_t_35 += __pyx_pybuffernd_x.diminfo[1].shape;
18876  if (unlikely(__pyx_t_35 < 0)) __pyx_t_9 = 1;
18877  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_9 = 1;
18878  if (__pyx_t_36 < 0) {
18879  __pyx_t_36 += __pyx_pybuffernd_x.diminfo[2].shape;
18880  if (unlikely(__pyx_t_36 < 0)) __pyx_t_9 = 2;
18881  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_9 = 2;
18882  if (unlikely(__pyx_t_9 != -1)) {
18883  __Pyx_RaiseBufferIndexError(__pyx_t_9);
18884  __PYX_ERR(0, 881, __pyx_L1_error)
18885  }
18886  __pyx_t_37 = __pyx_v_eN;
18887  __pyx_t_38 = __pyx_v_k;
18888  __pyx_t_39 = 1;
18889  __pyx_t_9 = -1;
18890  if (__pyx_t_37 < 0) {
18891  __pyx_t_37 += __pyx_pybuffernd_v.diminfo[0].shape;
18892  if (unlikely(__pyx_t_37 < 0)) __pyx_t_9 = 0;
18893  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
18894  if (__pyx_t_38 < 0) {
18895  __pyx_t_38 += __pyx_pybuffernd_v.diminfo[1].shape;
18896  if (unlikely(__pyx_t_38 < 0)) __pyx_t_9 = 1;
18897  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
18898  if (__pyx_t_39 < 0) {
18899  __pyx_t_39 += __pyx_pybuffernd_v.diminfo[2].shape;
18900  if (unlikely(__pyx_t_39 < 0)) __pyx_t_9 = 2;
18901  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
18902  if (unlikely(__pyx_t_9 != -1)) {
18903  __Pyx_RaiseBufferIndexError(__pyx_t_9);
18904  __PYX_ERR(0, 881, __pyx_L1_error)
18905  }
18906  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_39, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_36, __pyx_pybuffernd_x.diminfo[2].strides))));
18907 
18908  /* "subsurfaceTransportFunctions.pyx":882
18909  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
18910  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
18911  * v[eN,k,2]=zVelocity # <<<<<<<<<<<<<<
18912  *
18913  * def helicalElementVelocityEval4(int transient,
18914  */
18915  __pyx_t_40 = __pyx_v_eN;
18916  __pyx_t_41 = __pyx_v_k;
18917  __pyx_t_42 = 2;
18918  __pyx_t_9 = -1;
18919  if (__pyx_t_40 < 0) {
18920  __pyx_t_40 += __pyx_pybuffernd_v.diminfo[0].shape;
18921  if (unlikely(__pyx_t_40 < 0)) __pyx_t_9 = 0;
18922  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_9 = 0;
18923  if (__pyx_t_41 < 0) {
18924  __pyx_t_41 += __pyx_pybuffernd_v.diminfo[1].shape;
18925  if (unlikely(__pyx_t_41 < 0)) __pyx_t_9 = 1;
18926  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_9 = 1;
18927  if (__pyx_t_42 < 0) {
18928  __pyx_t_42 += __pyx_pybuffernd_v.diminfo[2].shape;
18929  if (unlikely(__pyx_t_42 < 0)) __pyx_t_9 = 2;
18930  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_9 = 2;
18931  if (unlikely(__pyx_t_9 != -1)) {
18932  __Pyx_RaiseBufferIndexError(__pyx_t_9);
18933  __PYX_ERR(0, 882, __pyx_L1_error)
18934  }
18935  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_42, __pyx_pybuffernd_v.diminfo[2].strides) = __pyx_v_zVelocity;
18936  }
18937  }
18938  }
18939  __pyx_L3:;
18940 
18941  /* "subsurfaceTransportFunctions.pyx":859
18942  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18943  *
18944  * def helicalElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
18945  * double t,
18946  * double tForReversal,
18947  */
18948 
18949  /* function exit code */
18950  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
18951  goto __pyx_L0;
18952  __pyx_L1_error:;
18953  __Pyx_XDECREF(__pyx_t_22);
18954  __Pyx_XDECREF(__pyx_t_23);
18955  __Pyx_XDECREF(__pyx_t_24);
18956  __Pyx_XDECREF(__pyx_t_27);
18957  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
18958  __Pyx_PyThreadState_declare
18959  __Pyx_PyThreadState_assign
18960  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
18961  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
18962  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
18963  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
18964  __Pyx_AddTraceback("subsurfaceTransportFunctions.helicalElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
18965  __pyx_r = NULL;
18966  goto __pyx_L2;
18967  __pyx_L0:;
18968  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
18969  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
18970  __pyx_L2:;
18971  __Pyx_XGIVEREF(__pyx_r);
18972  __Pyx_RefNannyFinishContext();
18973  return __pyx_r;
18974 }
18975 
18976 /* "subsurfaceTransportFunctions.pyx":884
18977  * v[eN,k,2]=zVelocity
18978  *
18979  * def helicalElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
18980  * double t,
18981  * double tForReversal,
18982  */
18983 
18984 /* Python wrapper */
18985 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_53helicalElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
18986 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_53helicalElementVelocityEval4 = {"helicalElementVelocityEval4", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_53helicalElementVelocityEval4, METH_VARARGS|METH_KEYWORDS, 0};
18987 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_53helicalElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
18988  int __pyx_v_transient;
18989  double __pyx_v_t;
18990  double __pyx_v_tForReversal;
18991  double __pyx_v_clock;
18992  double __pyx_v_zVelocity;
18993  double __pyx_v_xc;
18994  double __pyx_v_yc;
18995  PyArrayObject *__pyx_v_x = 0;
18996  PyArrayObject *__pyx_v_v = 0;
18997  PyObject *__pyx_r = 0;
18998  __Pyx_RefNannyDeclarations
18999  __Pyx_RefNannySetupContext("helicalElementVelocityEval4 (wrapper)", 0);
19000  {
19001  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transient,&__pyx_n_s_t,&__pyx_n_s_tForReversal,&__pyx_n_s_clock,&__pyx_n_s_zVelocity,&__pyx_n_s_xc,&__pyx_n_s_yc,&__pyx_n_s_x,&__pyx_n_s_v,0};
19002  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
19003  if (unlikely(__pyx_kwds)) {
19004  Py_ssize_t kw_args;
19005  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
19006  switch (pos_args) {
19007  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
19008  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
19009  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
19010  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
19011  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
19012  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
19013  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19014  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19015  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19016  case 0: break;
19017  default: goto __pyx_L5_argtuple_error;
19018  }
19019  kw_args = PyDict_Size(__pyx_kwds);
19020  switch (pos_args) {
19021  case 0:
19022  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_transient)) != 0)) kw_args--;
19023  else goto __pyx_L5_argtuple_error;
19024  case 1:
19025  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
19026  else {
19027  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 1); __PYX_ERR(0, 884, __pyx_L3_error)
19028  }
19029  case 2:
19030  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tForReversal)) != 0)) kw_args--;
19031  else {
19032  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 2); __PYX_ERR(0, 884, __pyx_L3_error)
19033  }
19034  case 3:
19035  if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_clock)) != 0)) kw_args--;
19036  else {
19037  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 3); __PYX_ERR(0, 884, __pyx_L3_error)
19038  }
19039  case 4:
19040  if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_zVelocity)) != 0)) kw_args--;
19041  else {
19042  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 4); __PYX_ERR(0, 884, __pyx_L3_error)
19043  }
19044  case 5:
19045  if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xc)) != 0)) kw_args--;
19046  else {
19047  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 5); __PYX_ERR(0, 884, __pyx_L3_error)
19048  }
19049  case 6:
19050  if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_yc)) != 0)) kw_args--;
19051  else {
19052  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 6); __PYX_ERR(0, 884, __pyx_L3_error)
19053  }
19054  case 7:
19055  if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
19056  else {
19057  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 7); __PYX_ERR(0, 884, __pyx_L3_error)
19058  }
19059  case 8:
19060  if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
19061  else {
19062  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 8); __PYX_ERR(0, 884, __pyx_L3_error)
19063  }
19064  }
19065  if (unlikely(kw_args > 0)) {
19066  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "helicalElementVelocityEval4") < 0)) __PYX_ERR(0, 884, __pyx_L3_error)
19067  }
19068  } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
19069  goto __pyx_L5_argtuple_error;
19070  } else {
19071  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19072  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19073  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19074  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
19075  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
19076  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
19077  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
19078  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
19079  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
19080  }
19081  __pyx_v_transient = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_transient == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 884, __pyx_L3_error)
19082  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 885, __pyx_L3_error)
19083  __pyx_v_tForReversal = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tForReversal == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 886, __pyx_L3_error)
19084  __pyx_v_clock = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_clock == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 887, __pyx_L3_error)
19085  __pyx_v_zVelocity = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_zVelocity == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 888, __pyx_L3_error)
19086  __pyx_v_xc = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_xc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 889, __pyx_L3_error)
19087  __pyx_v_yc = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_yc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 889, __pyx_L3_error)
19088  __pyx_v_x = ((PyArrayObject *)values[7]);
19089  __pyx_v_v = ((PyArrayObject *)values[8]);
19090  }
19091  goto __pyx_L4_argument_unpacking_done;
19092  __pyx_L5_argtuple_error:;
19093  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 884, __pyx_L3_error)
19094  __pyx_L3_error:;
19095  __Pyx_AddTraceback("subsurfaceTransportFunctions.helicalElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
19096  __Pyx_RefNannyFinishContext();
19097  return NULL;
19098  __pyx_L4_argument_unpacking_done:;
19099  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 890, __pyx_L1_error)
19100  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 891, __pyx_L1_error)
19101  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_52helicalElementVelocityEval4(__pyx_self, __pyx_v_transient, __pyx_v_t, __pyx_v_tForReversal, __pyx_v_clock, __pyx_v_zVelocity, __pyx_v_xc, __pyx_v_yc, __pyx_v_x, __pyx_v_v);
19102 
19103  /* function exit code */
19104  goto __pyx_L0;
19105  __pyx_L1_error:;
19106  __pyx_r = NULL;
19107  __pyx_L0:;
19108  __Pyx_RefNannyFinishContext();
19109  return __pyx_r;
19110 }
19111 
19112 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_52helicalElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_zVelocity, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v) {
19113  int __pyx_v_eN;
19114  int __pyx_v_ebN;
19115  int __pyx_v_k;
19116  double __pyx_v_pi;
19117  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
19118  __Pyx_Buffer __pyx_pybuffer_v;
19119  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
19120  __Pyx_Buffer __pyx_pybuffer_x;
19121  PyObject *__pyx_r = NULL;
19122  __Pyx_RefNannyDeclarations
19123  int __pyx_t_1;
19124  npy_intp __pyx_t_2;
19125  int __pyx_t_3;
19126  npy_intp __pyx_t_4;
19127  int __pyx_t_5;
19128  npy_intp __pyx_t_6;
19129  int __pyx_t_7;
19130  Py_ssize_t __pyx_t_8;
19131  Py_ssize_t __pyx_t_9;
19132  Py_ssize_t __pyx_t_10;
19133  Py_ssize_t __pyx_t_11;
19134  int __pyx_t_12;
19135  Py_ssize_t __pyx_t_13;
19136  Py_ssize_t __pyx_t_14;
19137  Py_ssize_t __pyx_t_15;
19138  Py_ssize_t __pyx_t_16;
19139  Py_ssize_t __pyx_t_17;
19140  Py_ssize_t __pyx_t_18;
19141  Py_ssize_t __pyx_t_19;
19142  Py_ssize_t __pyx_t_20;
19143  Py_ssize_t __pyx_t_21;
19144  Py_ssize_t __pyx_t_22;
19145  Py_ssize_t __pyx_t_23;
19146  Py_ssize_t __pyx_t_24;
19147  Py_ssize_t __pyx_t_25;
19148  Py_ssize_t __pyx_t_26;
19149  Py_ssize_t __pyx_t_27;
19150  Py_ssize_t __pyx_t_28;
19151  PyObject *__pyx_t_29 = NULL;
19152  PyObject *__pyx_t_30 = NULL;
19153  PyObject *__pyx_t_31 = NULL;
19154  PyObject *__pyx_t_32 = NULL;
19155  double __pyx_t_33;
19156  double __pyx_t_34;
19157  Py_ssize_t __pyx_t_35;
19158  Py_ssize_t __pyx_t_36;
19159  Py_ssize_t __pyx_t_37;
19160  Py_ssize_t __pyx_t_38;
19161  Py_ssize_t __pyx_t_39;
19162  Py_ssize_t __pyx_t_40;
19163  Py_ssize_t __pyx_t_41;
19164  Py_ssize_t __pyx_t_42;
19165  Py_ssize_t __pyx_t_43;
19166  Py_ssize_t __pyx_t_44;
19167  Py_ssize_t __pyx_t_45;
19168  Py_ssize_t __pyx_t_46;
19169  Py_ssize_t __pyx_t_47;
19170  Py_ssize_t __pyx_t_48;
19171  Py_ssize_t __pyx_t_49;
19172  Py_ssize_t __pyx_t_50;
19173  Py_ssize_t __pyx_t_51;
19174  Py_ssize_t __pyx_t_52;
19175  Py_ssize_t __pyx_t_53;
19176  Py_ssize_t __pyx_t_54;
19177  __Pyx_RefNannySetupContext("helicalElementVelocityEval4", 0);
19178  __pyx_pybuffer_x.pybuffer.buf = NULL;
19179  __pyx_pybuffer_x.refcount = 0;
19180  __pyx_pybuffernd_x.data = NULL;
19181  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
19182  __pyx_pybuffer_v.pybuffer.buf = NULL;
19183  __pyx_pybuffer_v.refcount = 0;
19184  __pyx_pybuffernd_v.data = NULL;
19185  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
19186  {
19187  __Pyx_BufFmt_StackElem __pyx_stack[1];
19188  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 884, __pyx_L1_error)
19189  }
19190  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
19191  {
19192  __Pyx_BufFmt_StackElem __pyx_stack[1];
19193  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 884, __pyx_L1_error)
19194  }
19195  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_v.diminfo[3].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_v.diminfo[3].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[3];
19196 
19197  /* "subsurfaceTransportFunctions.pyx":894
19198  * cdef int eN,ebN,k
19199  * cdef double pi
19200  * pi = M_PI # <<<<<<<<<<<<<<
19201  * if transient == 1:
19202  * for eN in range(x.shape[0]):
19203  */
19204  __pyx_v_pi = M_PI;
19205 
19206  /* "subsurfaceTransportFunctions.pyx":895
19207  * cdef double pi
19208  * pi = M_PI
19209  * if transient == 1: # <<<<<<<<<<<<<<
19210  * for eN in range(x.shape[0]):
19211  * for ebN in range(x.shape[1]):
19212  */
19213  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
19214  if (__pyx_t_1) {
19215 
19216  /* "subsurfaceTransportFunctions.pyx":896
19217  * pi = M_PI
19218  * if transient == 1:
19219  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
19220  * for ebN in range(x.shape[1]):
19221  * for k in range(x.shape[2]):
19222  */
19223  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
19224  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
19225  __pyx_v_eN = __pyx_t_3;
19226 
19227  /* "subsurfaceTransportFunctions.pyx":897
19228  * if transient == 1:
19229  * for eN in range(x.shape[0]):
19230  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
19231  * for k in range(x.shape[2]):
19232  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
19233  */
19234  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
19235  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
19236  __pyx_v_ebN = __pyx_t_5;
19237 
19238  /* "subsurfaceTransportFunctions.pyx":898
19239  * for eN in range(x.shape[0]):
19240  * for ebN in range(x.shape[1]):
19241  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
19242  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
19243  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
19244  */
19245  __pyx_t_6 = (__pyx_v_x->dimensions[2]);
19246  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
19247  __pyx_v_k = __pyx_t_7;
19248 
19249  /* "subsurfaceTransportFunctions.pyx":899
19250  * for ebN in range(x.shape[1]):
19251  * for k in range(x.shape[2]):
19252  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
19253  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
19254  * v[eN,ebN,k,2]=zVelocity
19255  */
19256  __pyx_t_8 = __pyx_v_eN;
19257  __pyx_t_9 = __pyx_v_ebN;
19258  __pyx_t_10 = __pyx_v_k;
19259  __pyx_t_11 = 1;
19260  __pyx_t_12 = -1;
19261  if (__pyx_t_8 < 0) {
19262  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[0].shape;
19263  if (unlikely(__pyx_t_8 < 0)) __pyx_t_12 = 0;
19264  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_12 = 0;
19265  if (__pyx_t_9 < 0) {
19266  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
19267  if (unlikely(__pyx_t_9 < 0)) __pyx_t_12 = 1;
19268  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_12 = 1;
19269  if (__pyx_t_10 < 0) {
19270  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[2].shape;
19271  if (unlikely(__pyx_t_10 < 0)) __pyx_t_12 = 2;
19272  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_12 = 2;
19273  if (__pyx_t_11 < 0) {
19274  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[3].shape;
19275  if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 3;
19276  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_12 = 3;
19277  if (unlikely(__pyx_t_12 != -1)) {
19278  __Pyx_RaiseBufferIndexError(__pyx_t_12);
19279  __PYX_ERR(0, 899, __pyx_L1_error)
19280  }
19281  __pyx_t_13 = __pyx_v_eN;
19282  __pyx_t_14 = __pyx_v_ebN;
19283  __pyx_t_15 = __pyx_v_k;
19284  __pyx_t_16 = 0;
19285  __pyx_t_12 = -1;
19286  if (__pyx_t_13 < 0) {
19287  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[0].shape;
19288  if (unlikely(__pyx_t_13 < 0)) __pyx_t_12 = 0;
19289  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
19290  if (__pyx_t_14 < 0) {
19291  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[1].shape;
19292  if (unlikely(__pyx_t_14 < 0)) __pyx_t_12 = 1;
19293  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
19294  if (__pyx_t_15 < 0) {
19295  __pyx_t_15 += __pyx_pybuffernd_v.diminfo[2].shape;
19296  if (unlikely(__pyx_t_15 < 0)) __pyx_t_12 = 2;
19297  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
19298  if (__pyx_t_16 < 0) {
19299  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[3].shape;
19300  if (unlikely(__pyx_t_16 < 0)) __pyx_t_12 = 3;
19301  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
19302  if (unlikely(__pyx_t_12 != -1)) {
19303  __Pyx_RaiseBufferIndexError(__pyx_t_12);
19304  __PYX_ERR(0, 899, __pyx_L1_error)
19305  }
19306  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_15, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
19307 
19308  /* "subsurfaceTransportFunctions.pyx":900
19309  * for k in range(x.shape[2]):
19310  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
19311  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
19312  * v[eN,ebN,k,2]=zVelocity
19313  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
19314  */
19315  __pyx_t_17 = __pyx_v_eN;
19316  __pyx_t_18 = __pyx_v_ebN;
19317  __pyx_t_19 = __pyx_v_k;
19318  __pyx_t_20 = 0;
19319  __pyx_t_12 = -1;
19320  if (__pyx_t_17 < 0) {
19321  __pyx_t_17 += __pyx_pybuffernd_x.diminfo[0].shape;
19322  if (unlikely(__pyx_t_17 < 0)) __pyx_t_12 = 0;
19323  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_12 = 0;
19324  if (__pyx_t_18 < 0) {
19325  __pyx_t_18 += __pyx_pybuffernd_x.diminfo[1].shape;
19326  if (unlikely(__pyx_t_18 < 0)) __pyx_t_12 = 1;
19327  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_12 = 1;
19328  if (__pyx_t_19 < 0) {
19329  __pyx_t_19 += __pyx_pybuffernd_x.diminfo[2].shape;
19330  if (unlikely(__pyx_t_19 < 0)) __pyx_t_12 = 2;
19331  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_12 = 2;
19332  if (__pyx_t_20 < 0) {
19333  __pyx_t_20 += __pyx_pybuffernd_x.diminfo[3].shape;
19334  if (unlikely(__pyx_t_20 < 0)) __pyx_t_12 = 3;
19335  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_12 = 3;
19336  if (unlikely(__pyx_t_12 != -1)) {
19337  __Pyx_RaiseBufferIndexError(__pyx_t_12);
19338  __PYX_ERR(0, 900, __pyx_L1_error)
19339  }
19340  __pyx_t_21 = __pyx_v_eN;
19341  __pyx_t_22 = __pyx_v_ebN;
19342  __pyx_t_23 = __pyx_v_k;
19343  __pyx_t_24 = 1;
19344  __pyx_t_12 = -1;
19345  if (__pyx_t_21 < 0) {
19346  __pyx_t_21 += __pyx_pybuffernd_v.diminfo[0].shape;
19347  if (unlikely(__pyx_t_21 < 0)) __pyx_t_12 = 0;
19348  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
19349  if (__pyx_t_22 < 0) {
19350  __pyx_t_22 += __pyx_pybuffernd_v.diminfo[1].shape;
19351  if (unlikely(__pyx_t_22 < 0)) __pyx_t_12 = 1;
19352  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
19353  if (__pyx_t_23 < 0) {
19354  __pyx_t_23 += __pyx_pybuffernd_v.diminfo[2].shape;
19355  if (unlikely(__pyx_t_23 < 0)) __pyx_t_12 = 2;
19356  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
19357  if (__pyx_t_24 < 0) {
19358  __pyx_t_24 += __pyx_pybuffernd_v.diminfo[3].shape;
19359  if (unlikely(__pyx_t_24 < 0)) __pyx_t_12 = 3;
19360  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
19361  if (unlikely(__pyx_t_12 != -1)) {
19362  __Pyx_RaiseBufferIndexError(__pyx_t_12);
19363  __PYX_ERR(0, 900, __pyx_L1_error)
19364  }
19365  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_23, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_24, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_19, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_20, __pyx_pybuffernd_x.diminfo[3].strides))));
19366 
19367  /* "subsurfaceTransportFunctions.pyx":901
19368  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
19369  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
19370  * v[eN,ebN,k,2]=zVelocity # <<<<<<<<<<<<<<
19371  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
19372  * else:
19373  */
19374  __pyx_t_25 = __pyx_v_eN;
19375  __pyx_t_26 = __pyx_v_ebN;
19376  __pyx_t_27 = __pyx_v_k;
19377  __pyx_t_28 = 2;
19378  __pyx_t_12 = -1;
19379  if (__pyx_t_25 < 0) {
19380  __pyx_t_25 += __pyx_pybuffernd_v.diminfo[0].shape;
19381  if (unlikely(__pyx_t_25 < 0)) __pyx_t_12 = 0;
19382  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
19383  if (__pyx_t_26 < 0) {
19384  __pyx_t_26 += __pyx_pybuffernd_v.diminfo[1].shape;
19385  if (unlikely(__pyx_t_26 < 0)) __pyx_t_12 = 1;
19386  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
19387  if (__pyx_t_27 < 0) {
19388  __pyx_t_27 += __pyx_pybuffernd_v.diminfo[2].shape;
19389  if (unlikely(__pyx_t_27 < 0)) __pyx_t_12 = 2;
19390  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
19391  if (__pyx_t_28 < 0) {
19392  __pyx_t_28 += __pyx_pybuffernd_v.diminfo[3].shape;
19393  if (unlikely(__pyx_t_28 < 0)) __pyx_t_12 = 3;
19394  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
19395  if (unlikely(__pyx_t_12 != -1)) {
19396  __Pyx_RaiseBufferIndexError(__pyx_t_12);
19397  __PYX_ERR(0, 901, __pyx_L1_error)
19398  }
19399  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_27, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_28, __pyx_pybuffernd_v.diminfo[3].strides) = __pyx_v_zVelocity;
19400 
19401  /* "subsurfaceTransportFunctions.pyx":902
19402  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
19403  * v[eN,ebN,k,2]=zVelocity
19404  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0)) # <<<<<<<<<<<<<<
19405  * else:
19406  * for eN in range(x.shape[0]):
19407  */
19408  __pyx_t_29 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 902, __pyx_L1_error)
19409  __Pyx_GOTREF(__pyx_t_29);
19410  __pyx_t_30 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_30)) __PYX_ERR(0, 902, __pyx_L1_error)
19411  __Pyx_GOTREF(__pyx_t_30);
19412  __pyx_t_31 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 902, __pyx_L1_error)
19413  __Pyx_GOTREF(__pyx_t_31);
19414  __pyx_t_32 = PyTuple_New(4); if (unlikely(!__pyx_t_32)) __PYX_ERR(0, 902, __pyx_L1_error)
19415  __Pyx_GOTREF(__pyx_t_32);
19416  __Pyx_GIVEREF(__pyx_t_29);
19417  PyTuple_SET_ITEM(__pyx_t_32, 0, __pyx_t_29);
19418  __Pyx_GIVEREF(__pyx_t_30);
19419  PyTuple_SET_ITEM(__pyx_t_32, 1, __pyx_t_30);
19420  __Pyx_GIVEREF(__pyx_t_31);
19421  PyTuple_SET_ITEM(__pyx_t_32, 2, __pyx_t_31);
19422  __Pyx_INCREF(__pyx_slice__8);
19423  __Pyx_GIVEREF(__pyx_slice__8);
19424  PyTuple_SET_ITEM(__pyx_t_32, 3, __pyx_slice__8);
19425  __pyx_t_29 = 0;
19426  __pyx_t_30 = 0;
19427  __pyx_t_31 = 0;
19428  __pyx_t_31 = PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_32); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 902, __pyx_L1_error)
19429  __Pyx_GOTREF(__pyx_t_31);
19430  __pyx_t_33 = (__pyx_v_pi * __pyx_v_t);
19431  __pyx_t_34 = (__pyx_v_tForReversal * 2.0);
19432  if (unlikely(__pyx_t_34 == 0)) {
19433  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
19434  __PYX_ERR(0, 902, __pyx_L1_error)
19435  }
19436  __pyx_t_30 = PyFloat_FromDouble((__pyx_v_clock * cos((__pyx_t_33 / __pyx_t_34)))); if (unlikely(!__pyx_t_30)) __PYX_ERR(0, 902, __pyx_L1_error)
19437  __Pyx_GOTREF(__pyx_t_30);
19438  __pyx_t_29 = PyNumber_InPlaceMultiply(__pyx_t_31, __pyx_t_30); if (unlikely(!__pyx_t_29)) __PYX_ERR(0, 902, __pyx_L1_error)
19439  __Pyx_GOTREF(__pyx_t_29);
19440  __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
19441  __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
19442  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_32, __pyx_t_29) < 0)) __PYX_ERR(0, 902, __pyx_L1_error)
19443  __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
19444  __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
19445  }
19446  }
19447  }
19448 
19449  /* "subsurfaceTransportFunctions.pyx":895
19450  * cdef double pi
19451  * pi = M_PI
19452  * if transient == 1: # <<<<<<<<<<<<<<
19453  * for eN in range(x.shape[0]):
19454  * for ebN in range(x.shape[1]):
19455  */
19456  goto __pyx_L3;
19457  }
19458 
19459  /* "subsurfaceTransportFunctions.pyx":904
19460  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
19461  * else:
19462  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
19463  * for ebN in range(x.shape[1]):
19464  * for k in range(x.shape[2]):
19465  */
19466  /*else*/ {
19467  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
19468  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
19469  __pyx_v_eN = __pyx_t_3;
19470 
19471  /* "subsurfaceTransportFunctions.pyx":905
19472  * else:
19473  * for eN in range(x.shape[0]):
19474  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
19475  * for k in range(x.shape[2]):
19476  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
19477  */
19478  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
19479  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
19480  __pyx_v_ebN = __pyx_t_5;
19481 
19482  /* "subsurfaceTransportFunctions.pyx":906
19483  * for eN in range(x.shape[0]):
19484  * for ebN in range(x.shape[1]):
19485  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
19486  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
19487  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
19488  */
19489  __pyx_t_6 = (__pyx_v_x->dimensions[2]);
19490  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
19491  __pyx_v_k = __pyx_t_7;
19492 
19493  /* "subsurfaceTransportFunctions.pyx":907
19494  * for ebN in range(x.shape[1]):
19495  * for k in range(x.shape[2]):
19496  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
19497  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
19498  * v[eN,ebN,k,2]=zVelocity
19499  */
19500  __pyx_t_35 = __pyx_v_eN;
19501  __pyx_t_36 = __pyx_v_ebN;
19502  __pyx_t_37 = __pyx_v_k;
19503  __pyx_t_38 = 1;
19504  __pyx_t_12 = -1;
19505  if (__pyx_t_35 < 0) {
19506  __pyx_t_35 += __pyx_pybuffernd_x.diminfo[0].shape;
19507  if (unlikely(__pyx_t_35 < 0)) __pyx_t_12 = 0;
19508  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_12 = 0;
19509  if (__pyx_t_36 < 0) {
19510  __pyx_t_36 += __pyx_pybuffernd_x.diminfo[1].shape;
19511  if (unlikely(__pyx_t_36 < 0)) __pyx_t_12 = 1;
19512  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_12 = 1;
19513  if (__pyx_t_37 < 0) {
19514  __pyx_t_37 += __pyx_pybuffernd_x.diminfo[2].shape;
19515  if (unlikely(__pyx_t_37 < 0)) __pyx_t_12 = 2;
19516  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_12 = 2;
19517  if (__pyx_t_38 < 0) {
19518  __pyx_t_38 += __pyx_pybuffernd_x.diminfo[3].shape;
19519  if (unlikely(__pyx_t_38 < 0)) __pyx_t_12 = 3;
19520  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_12 = 3;
19521  if (unlikely(__pyx_t_12 != -1)) {
19522  __Pyx_RaiseBufferIndexError(__pyx_t_12);
19523  __PYX_ERR(0, 907, __pyx_L1_error)
19524  }
19525  __pyx_t_39 = __pyx_v_eN;
19526  __pyx_t_40 = __pyx_v_ebN;
19527  __pyx_t_41 = __pyx_v_k;
19528  __pyx_t_42 = 0;
19529  __pyx_t_12 = -1;
19530  if (__pyx_t_39 < 0) {
19531  __pyx_t_39 += __pyx_pybuffernd_v.diminfo[0].shape;
19532  if (unlikely(__pyx_t_39 < 0)) __pyx_t_12 = 0;
19533  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
19534  if (__pyx_t_40 < 0) {
19535  __pyx_t_40 += __pyx_pybuffernd_v.diminfo[1].shape;
19536  if (unlikely(__pyx_t_40 < 0)) __pyx_t_12 = 1;
19537  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
19538  if (__pyx_t_41 < 0) {
19539  __pyx_t_41 += __pyx_pybuffernd_v.diminfo[2].shape;
19540  if (unlikely(__pyx_t_41 < 0)) __pyx_t_12 = 2;
19541  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
19542  if (__pyx_t_42 < 0) {
19543  __pyx_t_42 += __pyx_pybuffernd_v.diminfo[3].shape;
19544  if (unlikely(__pyx_t_42 < 0)) __pyx_t_12 = 3;
19545  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
19546  if (unlikely(__pyx_t_12 != -1)) {
19547  __Pyx_RaiseBufferIndexError(__pyx_t_12);
19548  __PYX_ERR(0, 907, __pyx_L1_error)
19549  }
19550  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_41, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_42, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_36, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_37, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_38, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
19551 
19552  /* "subsurfaceTransportFunctions.pyx":908
19553  * for k in range(x.shape[2]):
19554  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
19555  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
19556  * v[eN,ebN,k,2]=zVelocity
19557  *
19558  */
19559  __pyx_t_43 = __pyx_v_eN;
19560  __pyx_t_44 = __pyx_v_ebN;
19561  __pyx_t_45 = __pyx_v_k;
19562  __pyx_t_46 = 0;
19563  __pyx_t_12 = -1;
19564  if (__pyx_t_43 < 0) {
19565  __pyx_t_43 += __pyx_pybuffernd_x.diminfo[0].shape;
19566  if (unlikely(__pyx_t_43 < 0)) __pyx_t_12 = 0;
19567  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_12 = 0;
19568  if (__pyx_t_44 < 0) {
19569  __pyx_t_44 += __pyx_pybuffernd_x.diminfo[1].shape;
19570  if (unlikely(__pyx_t_44 < 0)) __pyx_t_12 = 1;
19571  } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_12 = 1;
19572  if (__pyx_t_45 < 0) {
19573  __pyx_t_45 += __pyx_pybuffernd_x.diminfo[2].shape;
19574  if (unlikely(__pyx_t_45 < 0)) __pyx_t_12 = 2;
19575  } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_12 = 2;
19576  if (__pyx_t_46 < 0) {
19577  __pyx_t_46 += __pyx_pybuffernd_x.diminfo[3].shape;
19578  if (unlikely(__pyx_t_46 < 0)) __pyx_t_12 = 3;
19579  } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_12 = 3;
19580  if (unlikely(__pyx_t_12 != -1)) {
19581  __Pyx_RaiseBufferIndexError(__pyx_t_12);
19582  __PYX_ERR(0, 908, __pyx_L1_error)
19583  }
19584  __pyx_t_47 = __pyx_v_eN;
19585  __pyx_t_48 = __pyx_v_ebN;
19586  __pyx_t_49 = __pyx_v_k;
19587  __pyx_t_50 = 1;
19588  __pyx_t_12 = -1;
19589  if (__pyx_t_47 < 0) {
19590  __pyx_t_47 += __pyx_pybuffernd_v.diminfo[0].shape;
19591  if (unlikely(__pyx_t_47 < 0)) __pyx_t_12 = 0;
19592  } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
19593  if (__pyx_t_48 < 0) {
19594  __pyx_t_48 += __pyx_pybuffernd_v.diminfo[1].shape;
19595  if (unlikely(__pyx_t_48 < 0)) __pyx_t_12 = 1;
19596  } else if (unlikely(__pyx_t_48 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
19597  if (__pyx_t_49 < 0) {
19598  __pyx_t_49 += __pyx_pybuffernd_v.diminfo[2].shape;
19599  if (unlikely(__pyx_t_49 < 0)) __pyx_t_12 = 2;
19600  } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
19601  if (__pyx_t_50 < 0) {
19602  __pyx_t_50 += __pyx_pybuffernd_v.diminfo[3].shape;
19603  if (unlikely(__pyx_t_50 < 0)) __pyx_t_12 = 3;
19604  } else if (unlikely(__pyx_t_50 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
19605  if (unlikely(__pyx_t_12 != -1)) {
19606  __Pyx_RaiseBufferIndexError(__pyx_t_12);
19607  __PYX_ERR(0, 908, __pyx_L1_error)
19608  }
19609  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_48, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_49, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_50, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_44, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_45, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_46, __pyx_pybuffernd_x.diminfo[3].strides))));
19610 
19611  /* "subsurfaceTransportFunctions.pyx":909
19612  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
19613  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
19614  * v[eN,ebN,k,2]=zVelocity # <<<<<<<<<<<<<<
19615  *
19616  * def vortexElementVelocityEval3(double t,
19617  */
19618  __pyx_t_51 = __pyx_v_eN;
19619  __pyx_t_52 = __pyx_v_ebN;
19620  __pyx_t_53 = __pyx_v_k;
19621  __pyx_t_54 = 2;
19622  __pyx_t_12 = -1;
19623  if (__pyx_t_51 < 0) {
19624  __pyx_t_51 += __pyx_pybuffernd_v.diminfo[0].shape;
19625  if (unlikely(__pyx_t_51 < 0)) __pyx_t_12 = 0;
19626  } else if (unlikely(__pyx_t_51 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_12 = 0;
19627  if (__pyx_t_52 < 0) {
19628  __pyx_t_52 += __pyx_pybuffernd_v.diminfo[1].shape;
19629  if (unlikely(__pyx_t_52 < 0)) __pyx_t_12 = 1;
19630  } else if (unlikely(__pyx_t_52 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_12 = 1;
19631  if (__pyx_t_53 < 0) {
19632  __pyx_t_53 += __pyx_pybuffernd_v.diminfo[2].shape;
19633  if (unlikely(__pyx_t_53 < 0)) __pyx_t_12 = 2;
19634  } else if (unlikely(__pyx_t_53 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_12 = 2;
19635  if (__pyx_t_54 < 0) {
19636  __pyx_t_54 += __pyx_pybuffernd_v.diminfo[3].shape;
19637  if (unlikely(__pyx_t_54 < 0)) __pyx_t_12 = 3;
19638  } else if (unlikely(__pyx_t_54 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_12 = 3;
19639  if (unlikely(__pyx_t_12 != -1)) {
19640  __Pyx_RaiseBufferIndexError(__pyx_t_12);
19641  __PYX_ERR(0, 909, __pyx_L1_error)
19642  }
19643  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_52, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_53, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_54, __pyx_pybuffernd_v.diminfo[3].strides) = __pyx_v_zVelocity;
19644  }
19645  }
19646  }
19647  }
19648  __pyx_L3:;
19649 
19650  /* "subsurfaceTransportFunctions.pyx":884
19651  * v[eN,k,2]=zVelocity
19652  *
19653  * def helicalElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
19654  * double t,
19655  * double tForReversal,
19656  */
19657 
19658  /* function exit code */
19659  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19660  goto __pyx_L0;
19661  __pyx_L1_error:;
19662  __Pyx_XDECREF(__pyx_t_29);
19663  __Pyx_XDECREF(__pyx_t_30);
19664  __Pyx_XDECREF(__pyx_t_31);
19665  __Pyx_XDECREF(__pyx_t_32);
19666  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
19667  __Pyx_PyThreadState_declare
19668  __Pyx_PyThreadState_assign
19669  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
19670  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
19671  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
19672  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
19673  __Pyx_AddTraceback("subsurfaceTransportFunctions.helicalElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
19674  __pyx_r = NULL;
19675  goto __pyx_L2;
19676  __pyx_L0:;
19677  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
19678  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
19679  __pyx_L2:;
19680  __Pyx_XGIVEREF(__pyx_r);
19681  __Pyx_RefNannyFinishContext();
19682  return __pyx_r;
19683 }
19684 
19685 /* "subsurfaceTransportFunctions.pyx":911
19686  * v[eN,ebN,k,2]=zVelocity
19687  *
19688  * def vortexElementVelocityEval3(double t, # <<<<<<<<<<<<<<
19689  * numpy.ndarray[DTYPE_t,ndim=3] x,
19690  * numpy.ndarray[DTYPE_t,ndim=3] v):
19691  */
19692 
19693 /* Python wrapper */
19694 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_55vortexElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
19695 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_55vortexElementVelocityEval3 = {"vortexElementVelocityEval3", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_55vortexElementVelocityEval3, METH_VARARGS|METH_KEYWORDS, 0};
19696 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_55vortexElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
19697  double __pyx_v_t;
19698  PyArrayObject *__pyx_v_x = 0;
19699  PyArrayObject *__pyx_v_v = 0;
19700  PyObject *__pyx_r = 0;
19701  __Pyx_RefNannyDeclarations
19702  __Pyx_RefNannySetupContext("vortexElementVelocityEval3 (wrapper)", 0);
19703  {
19704  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_x,&__pyx_n_s_v,0};
19705  PyObject* values[3] = {0,0,0};
19706  if (unlikely(__pyx_kwds)) {
19707  Py_ssize_t kw_args;
19708  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
19709  switch (pos_args) {
19710  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19711  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19712  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19713  case 0: break;
19714  default: goto __pyx_L5_argtuple_error;
19715  }
19716  kw_args = PyDict_Size(__pyx_kwds);
19717  switch (pos_args) {
19718  case 0:
19719  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
19720  else goto __pyx_L5_argtuple_error;
19721  case 1:
19722  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
19723  else {
19724  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval3", 1, 3, 3, 1); __PYX_ERR(0, 911, __pyx_L3_error)
19725  }
19726  case 2:
19727  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
19728  else {
19729  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval3", 1, 3, 3, 2); __PYX_ERR(0, 911, __pyx_L3_error)
19730  }
19731  }
19732  if (unlikely(kw_args > 0)) {
19733  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vortexElementVelocityEval3") < 0)) __PYX_ERR(0, 911, __pyx_L3_error)
19734  }
19735  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
19736  goto __pyx_L5_argtuple_error;
19737  } else {
19738  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19739  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19740  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19741  }
19742  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 911, __pyx_L3_error)
19743  __pyx_v_x = ((PyArrayObject *)values[1]);
19744  __pyx_v_v = ((PyArrayObject *)values[2]);
19745  }
19746  goto __pyx_L4_argument_unpacking_done;
19747  __pyx_L5_argtuple_error:;
19748  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval3", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 911, __pyx_L3_error)
19749  __pyx_L3_error:;
19750  __Pyx_AddTraceback("subsurfaceTransportFunctions.vortexElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
19751  __Pyx_RefNannyFinishContext();
19752  return NULL;
19753  __pyx_L4_argument_unpacking_done:;
19754  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 912, __pyx_L1_error)
19755  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 913, __pyx_L1_error)
19756  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_54vortexElementVelocityEval3(__pyx_self, __pyx_v_t, __pyx_v_x, __pyx_v_v);
19757 
19758  /* function exit code */
19759  goto __pyx_L0;
19760  __pyx_L1_error:;
19761  __pyx_r = NULL;
19762  __pyx_L0:;
19763  __Pyx_RefNannyFinishContext();
19764  return __pyx_r;
19765 }
19766 
19767 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_54vortexElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v) {
19768  int __pyx_v_eN;
19769  int __pyx_v_k;
19770  double __pyx_v_pi;
19771  double __pyx_v_one8;
19772  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
19773  __Pyx_Buffer __pyx_pybuffer_v;
19774  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
19775  __Pyx_Buffer __pyx_pybuffer_x;
19776  PyObject *__pyx_r = NULL;
19777  __Pyx_RefNannyDeclarations
19778  npy_intp __pyx_t_1;
19779  int __pyx_t_2;
19780  npy_intp __pyx_t_3;
19781  int __pyx_t_4;
19782  Py_ssize_t __pyx_t_5;
19783  Py_ssize_t __pyx_t_6;
19784  Py_ssize_t __pyx_t_7;
19785  int __pyx_t_8;
19786  Py_ssize_t __pyx_t_9;
19787  Py_ssize_t __pyx_t_10;
19788  Py_ssize_t __pyx_t_11;
19789  Py_ssize_t __pyx_t_12;
19790  Py_ssize_t __pyx_t_13;
19791  Py_ssize_t __pyx_t_14;
19792  Py_ssize_t __pyx_t_15;
19793  Py_ssize_t __pyx_t_16;
19794  Py_ssize_t __pyx_t_17;
19795  Py_ssize_t __pyx_t_18;
19796  Py_ssize_t __pyx_t_19;
19797  Py_ssize_t __pyx_t_20;
19798  Py_ssize_t __pyx_t_21;
19799  Py_ssize_t __pyx_t_22;
19800  Py_ssize_t __pyx_t_23;
19801  Py_ssize_t __pyx_t_24;
19802  Py_ssize_t __pyx_t_25;
19803  Py_ssize_t __pyx_t_26;
19804  Py_ssize_t __pyx_t_27;
19805  Py_ssize_t __pyx_t_28;
19806  Py_ssize_t __pyx_t_29;
19807  __Pyx_RefNannySetupContext("vortexElementVelocityEval3", 0);
19808  __pyx_pybuffer_x.pybuffer.buf = NULL;
19809  __pyx_pybuffer_x.refcount = 0;
19810  __pyx_pybuffernd_x.data = NULL;
19811  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
19812  __pyx_pybuffer_v.pybuffer.buf = NULL;
19813  __pyx_pybuffer_v.refcount = 0;
19814  __pyx_pybuffernd_v.data = NULL;
19815  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
19816  {
19817  __Pyx_BufFmt_StackElem __pyx_stack[1];
19818  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 911, __pyx_L1_error)
19819  }
19820  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
19821  {
19822  __Pyx_BufFmt_StackElem __pyx_stack[1];
19823  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 911, __pyx_L1_error)
19824  }
19825  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2];
19826 
19827  /* "subsurfaceTransportFunctions.pyx":916
19828  * cdef int eN,k
19829  * cdef double pi,one8
19830  * pi = M_PI # <<<<<<<<<<<<<<
19831  * one8 = 1.0/8.0
19832  * for eN in range(x.shape[0]):
19833  */
19834  __pyx_v_pi = M_PI;
19835 
19836  /* "subsurfaceTransportFunctions.pyx":917
19837  * cdef double pi,one8
19838  * pi = M_PI
19839  * one8 = 1.0/8.0 # <<<<<<<<<<<<<<
19840  * for eN in range(x.shape[0]):
19841  * for k in range(x.shape[1]):
19842  */
19843  __pyx_v_one8 = (1.0 / 8.0);
19844 
19845  /* "subsurfaceTransportFunctions.pyx":918
19846  * pi = M_PI
19847  * one8 = 1.0/8.0
19848  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
19849  * for k in range(x.shape[1]):
19850  * v[eN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,k,1])*sin(pi*x[eN,k,0])*sin(pi*x[eN,k,0]);
19851  */
19852  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
19853  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
19854  __pyx_v_eN = __pyx_t_2;
19855 
19856  /* "subsurfaceTransportFunctions.pyx":919
19857  * one8 = 1.0/8.0
19858  * for eN in range(x.shape[0]):
19859  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
19860  * v[eN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,k,1])*sin(pi*x[eN,k,0])*sin(pi*x[eN,k,0]);
19861  * v[eN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,k,0])*sin(pi*x[eN,k,1])*sin(pi*x[eN,k,1]);
19862  */
19863  __pyx_t_3 = (__pyx_v_x->dimensions[1]);
19864  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19865  __pyx_v_k = __pyx_t_4;
19866 
19867  /* "subsurfaceTransportFunctions.pyx":920
19868  * for eN in range(x.shape[0]):
19869  * for k in range(x.shape[1]):
19870  * v[eN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,k,1])*sin(pi*x[eN,k,0])*sin(pi*x[eN,k,0]); # <<<<<<<<<<<<<<
19871  * v[eN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,k,0])*sin(pi*x[eN,k,1])*sin(pi*x[eN,k,1]);
19872  *
19873  */
19874  __pyx_t_5 = __pyx_v_eN;
19875  __pyx_t_6 = __pyx_v_k;
19876  __pyx_t_7 = 1;
19877  __pyx_t_8 = -1;
19878  if (__pyx_t_5 < 0) {
19879  __pyx_t_5 += __pyx_pybuffernd_x.diminfo[0].shape;
19880  if (unlikely(__pyx_t_5 < 0)) __pyx_t_8 = 0;
19881  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_8 = 0;
19882  if (__pyx_t_6 < 0) {
19883  __pyx_t_6 += __pyx_pybuffernd_x.diminfo[1].shape;
19884  if (unlikely(__pyx_t_6 < 0)) __pyx_t_8 = 1;
19885  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_8 = 1;
19886  if (__pyx_t_7 < 0) {
19887  __pyx_t_7 += __pyx_pybuffernd_x.diminfo[2].shape;
19888  if (unlikely(__pyx_t_7 < 0)) __pyx_t_8 = 2;
19889  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_8 = 2;
19890  if (unlikely(__pyx_t_8 != -1)) {
19891  __Pyx_RaiseBufferIndexError(__pyx_t_8);
19892  __PYX_ERR(0, 920, __pyx_L1_error)
19893  }
19894  __pyx_t_9 = __pyx_v_eN;
19895  __pyx_t_10 = __pyx_v_k;
19896  __pyx_t_11 = 0;
19897  __pyx_t_8 = -1;
19898  if (__pyx_t_9 < 0) {
19899  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[0].shape;
19900  if (unlikely(__pyx_t_9 < 0)) __pyx_t_8 = 0;
19901  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_8 = 0;
19902  if (__pyx_t_10 < 0) {
19903  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[1].shape;
19904  if (unlikely(__pyx_t_10 < 0)) __pyx_t_8 = 1;
19905  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_8 = 1;
19906  if (__pyx_t_11 < 0) {
19907  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[2].shape;
19908  if (unlikely(__pyx_t_11 < 0)) __pyx_t_8 = 2;
19909  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_8 = 2;
19910  if (unlikely(__pyx_t_8 != -1)) {
19911  __Pyx_RaiseBufferIndexError(__pyx_t_8);
19912  __PYX_ERR(0, 920, __pyx_L1_error)
19913  }
19914  __pyx_t_12 = __pyx_v_eN;
19915  __pyx_t_13 = __pyx_v_k;
19916  __pyx_t_14 = 0;
19917  __pyx_t_8 = -1;
19918  if (__pyx_t_12 < 0) {
19919  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[0].shape;
19920  if (unlikely(__pyx_t_12 < 0)) __pyx_t_8 = 0;
19921  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_8 = 0;
19922  if (__pyx_t_13 < 0) {
19923  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[1].shape;
19924  if (unlikely(__pyx_t_13 < 0)) __pyx_t_8 = 1;
19925  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_8 = 1;
19926  if (__pyx_t_14 < 0) {
19927  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[2].shape;
19928  if (unlikely(__pyx_t_14 < 0)) __pyx_t_8 = 2;
19929  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_8 = 2;
19930  if (unlikely(__pyx_t_8 != -1)) {
19931  __Pyx_RaiseBufferIndexError(__pyx_t_8);
19932  __PYX_ERR(0, 920, __pyx_L1_error)
19933  }
19934  __pyx_t_15 = __pyx_v_eN;
19935  __pyx_t_16 = __pyx_v_k;
19936  __pyx_t_17 = 0;
19937  __pyx_t_8 = -1;
19938  if (__pyx_t_15 < 0) {
19939  __pyx_t_15 += __pyx_pybuffernd_v.diminfo[0].shape;
19940  if (unlikely(__pyx_t_15 < 0)) __pyx_t_8 = 0;
19941  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_8 = 0;
19942  if (__pyx_t_16 < 0) {
19943  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[1].shape;
19944  if (unlikely(__pyx_t_16 < 0)) __pyx_t_8 = 1;
19945  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_8 = 1;
19946  if (__pyx_t_17 < 0) {
19947  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[2].shape;
19948  if (unlikely(__pyx_t_17 < 0)) __pyx_t_8 = 2;
19949  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_8 = 2;
19950  if (unlikely(__pyx_t_8 != -1)) {
19951  __Pyx_RaiseBufferIndexError(__pyx_t_8);
19952  __PYX_ERR(0, 920, __pyx_L1_error)
19953  }
19954  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[2].strides) = (((cos(((__pyx_v_pi * __pyx_v_one8) * __pyx_v_t)) * sin(((2.0 * __pyx_v_pi) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_7, __pyx_pybuffernd_x.diminfo[2].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[2].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[2].strides)))));
19955 
19956  /* "subsurfaceTransportFunctions.pyx":921
19957  * for k in range(x.shape[1]):
19958  * v[eN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,k,1])*sin(pi*x[eN,k,0])*sin(pi*x[eN,k,0]);
19959  * v[eN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,k,0])*sin(pi*x[eN,k,1])*sin(pi*x[eN,k,1]); # <<<<<<<<<<<<<<
19960  *
19961  *
19962  */
19963  __pyx_t_18 = __pyx_v_eN;
19964  __pyx_t_19 = __pyx_v_k;
19965  __pyx_t_20 = 0;
19966  __pyx_t_8 = -1;
19967  if (__pyx_t_18 < 0) {
19968  __pyx_t_18 += __pyx_pybuffernd_x.diminfo[0].shape;
19969  if (unlikely(__pyx_t_18 < 0)) __pyx_t_8 = 0;
19970  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_8 = 0;
19971  if (__pyx_t_19 < 0) {
19972  __pyx_t_19 += __pyx_pybuffernd_x.diminfo[1].shape;
19973  if (unlikely(__pyx_t_19 < 0)) __pyx_t_8 = 1;
19974  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_8 = 1;
19975  if (__pyx_t_20 < 0) {
19976  __pyx_t_20 += __pyx_pybuffernd_x.diminfo[2].shape;
19977  if (unlikely(__pyx_t_20 < 0)) __pyx_t_8 = 2;
19978  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_8 = 2;
19979  if (unlikely(__pyx_t_8 != -1)) {
19980  __Pyx_RaiseBufferIndexError(__pyx_t_8);
19981  __PYX_ERR(0, 921, __pyx_L1_error)
19982  }
19983  __pyx_t_21 = __pyx_v_eN;
19984  __pyx_t_22 = __pyx_v_k;
19985  __pyx_t_23 = 1;
19986  __pyx_t_8 = -1;
19987  if (__pyx_t_21 < 0) {
19988  __pyx_t_21 += __pyx_pybuffernd_x.diminfo[0].shape;
19989  if (unlikely(__pyx_t_21 < 0)) __pyx_t_8 = 0;
19990  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_8 = 0;
19991  if (__pyx_t_22 < 0) {
19992  __pyx_t_22 += __pyx_pybuffernd_x.diminfo[1].shape;
19993  if (unlikely(__pyx_t_22 < 0)) __pyx_t_8 = 1;
19994  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_8 = 1;
19995  if (__pyx_t_23 < 0) {
19996  __pyx_t_23 += __pyx_pybuffernd_x.diminfo[2].shape;
19997  if (unlikely(__pyx_t_23 < 0)) __pyx_t_8 = 2;
19998  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_8 = 2;
19999  if (unlikely(__pyx_t_8 != -1)) {
20000  __Pyx_RaiseBufferIndexError(__pyx_t_8);
20001  __PYX_ERR(0, 921, __pyx_L1_error)
20002  }
20003  __pyx_t_24 = __pyx_v_eN;
20004  __pyx_t_25 = __pyx_v_k;
20005  __pyx_t_26 = 1;
20006  __pyx_t_8 = -1;
20007  if (__pyx_t_24 < 0) {
20008  __pyx_t_24 += __pyx_pybuffernd_x.diminfo[0].shape;
20009  if (unlikely(__pyx_t_24 < 0)) __pyx_t_8 = 0;
20010  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_8 = 0;
20011  if (__pyx_t_25 < 0) {
20012  __pyx_t_25 += __pyx_pybuffernd_x.diminfo[1].shape;
20013  if (unlikely(__pyx_t_25 < 0)) __pyx_t_8 = 1;
20014  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_8 = 1;
20015  if (__pyx_t_26 < 0) {
20016  __pyx_t_26 += __pyx_pybuffernd_x.diminfo[2].shape;
20017  if (unlikely(__pyx_t_26 < 0)) __pyx_t_8 = 2;
20018  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_8 = 2;
20019  if (unlikely(__pyx_t_8 != -1)) {
20020  __Pyx_RaiseBufferIndexError(__pyx_t_8);
20021  __PYX_ERR(0, 921, __pyx_L1_error)
20022  }
20023  __pyx_t_27 = __pyx_v_eN;
20024  __pyx_t_28 = __pyx_v_k;
20025  __pyx_t_29 = 1;
20026  __pyx_t_8 = -1;
20027  if (__pyx_t_27 < 0) {
20028  __pyx_t_27 += __pyx_pybuffernd_v.diminfo[0].shape;
20029  if (unlikely(__pyx_t_27 < 0)) __pyx_t_8 = 0;
20030  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_8 = 0;
20031  if (__pyx_t_28 < 0) {
20032  __pyx_t_28 += __pyx_pybuffernd_v.diminfo[1].shape;
20033  if (unlikely(__pyx_t_28 < 0)) __pyx_t_8 = 1;
20034  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_8 = 1;
20035  if (__pyx_t_29 < 0) {
20036  __pyx_t_29 += __pyx_pybuffernd_v.diminfo[2].shape;
20037  if (unlikely(__pyx_t_29 < 0)) __pyx_t_8 = 2;
20038  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_8 = 2;
20039  if (unlikely(__pyx_t_8 != -1)) {
20040  __Pyx_RaiseBufferIndexError(__pyx_t_8);
20041  __PYX_ERR(0, 921, __pyx_L1_error)
20042  }
20043  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_29, __pyx_pybuffernd_v.diminfo[2].strides) = ((((-cos(((__pyx_v_pi * __pyx_v_one8) * __pyx_v_t))) * sin(((2.0 * __pyx_v_pi) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_x.diminfo[2].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_23, __pyx_pybuffernd_x.diminfo[2].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_26, __pyx_pybuffernd_x.diminfo[2].strides)))));
20044  }
20045  }
20046 
20047  /* "subsurfaceTransportFunctions.pyx":911
20048  * v[eN,ebN,k,2]=zVelocity
20049  *
20050  * def vortexElementVelocityEval3(double t, # <<<<<<<<<<<<<<
20051  * numpy.ndarray[DTYPE_t,ndim=3] x,
20052  * numpy.ndarray[DTYPE_t,ndim=3] v):
20053  */
20054 
20055  /* function exit code */
20056  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20057  goto __pyx_L0;
20058  __pyx_L1_error:;
20059  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
20060  __Pyx_PyThreadState_declare
20061  __Pyx_PyThreadState_assign
20062  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
20063  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
20064  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
20065  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
20066  __Pyx_AddTraceback("subsurfaceTransportFunctions.vortexElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
20067  __pyx_r = NULL;
20068  goto __pyx_L2;
20069  __pyx_L0:;
20070  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
20071  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
20072  __pyx_L2:;
20073  __Pyx_XGIVEREF(__pyx_r);
20074  __Pyx_RefNannyFinishContext();
20075  return __pyx_r;
20076 }
20077 
20078 /* "subsurfaceTransportFunctions.pyx":924
20079  *
20080  *
20081  * def vortexElementVelocityEval4(double t, # <<<<<<<<<<<<<<
20082  * numpy.ndarray[DTYPE_t,ndim=4] x,
20083  * numpy.ndarray[DTYPE_t,ndim=4] v):
20084  */
20085 
20086 /* Python wrapper */
20087 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_57vortexElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
20088 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_57vortexElementVelocityEval4 = {"vortexElementVelocityEval4", (PyCFunction)__pyx_pw_28subsurfaceTransportFunctions_57vortexElementVelocityEval4, METH_VARARGS|METH_KEYWORDS, 0};
20089 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_57vortexElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
20090  double __pyx_v_t;
20091  PyArrayObject *__pyx_v_x = 0;
20092  PyArrayObject *__pyx_v_v = 0;
20093  PyObject *__pyx_r = 0;
20094  __Pyx_RefNannyDeclarations
20095  __Pyx_RefNannySetupContext("vortexElementVelocityEval4 (wrapper)", 0);
20096  {
20097  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_x,&__pyx_n_s_v,0};
20098  PyObject* values[3] = {0,0,0};
20099  if (unlikely(__pyx_kwds)) {
20100  Py_ssize_t kw_args;
20101  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
20102  switch (pos_args) {
20103  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20104  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20105  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20106  case 0: break;
20107  default: goto __pyx_L5_argtuple_error;
20108  }
20109  kw_args = PyDict_Size(__pyx_kwds);
20110  switch (pos_args) {
20111  case 0:
20112  if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
20113  else goto __pyx_L5_argtuple_error;
20114  case 1:
20115  if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
20116  else {
20117  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval4", 1, 3, 3, 1); __PYX_ERR(0, 924, __pyx_L3_error)
20118  }
20119  case 2:
20120  if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
20121  else {
20122  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval4", 1, 3, 3, 2); __PYX_ERR(0, 924, __pyx_L3_error)
20123  }
20124  }
20125  if (unlikely(kw_args > 0)) {
20126  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vortexElementVelocityEval4") < 0)) __PYX_ERR(0, 924, __pyx_L3_error)
20127  }
20128  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
20129  goto __pyx_L5_argtuple_error;
20130  } else {
20131  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20132  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20133  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20134  }
20135  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 924, __pyx_L3_error)
20136  __pyx_v_x = ((PyArrayObject *)values[1]);
20137  __pyx_v_v = ((PyArrayObject *)values[2]);
20138  }
20139  goto __pyx_L4_argument_unpacking_done;
20140  __pyx_L5_argtuple_error:;
20141  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval4", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 924, __pyx_L3_error)
20142  __pyx_L3_error:;
20143  __Pyx_AddTraceback("subsurfaceTransportFunctions.vortexElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
20144  __Pyx_RefNannyFinishContext();
20145  return NULL;
20146  __pyx_L4_argument_unpacking_done:;
20147  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 925, __pyx_L1_error)
20148  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 926, __pyx_L1_error)
20149  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_56vortexElementVelocityEval4(__pyx_self, __pyx_v_t, __pyx_v_x, __pyx_v_v);
20150 
20151  /* function exit code */
20152  goto __pyx_L0;
20153  __pyx_L1_error:;
20154  __pyx_r = NULL;
20155  __pyx_L0:;
20156  __Pyx_RefNannyFinishContext();
20157  return __pyx_r;
20158 }
20159 
20160 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_56vortexElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v) {
20161  int __pyx_v_eN;
20162  int __pyx_v_k;
20163  int __pyx_v_ebN;
20164  double __pyx_v_pi;
20165  double __pyx_v_one8;
20166  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
20167  __Pyx_Buffer __pyx_pybuffer_v;
20168  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
20169  __Pyx_Buffer __pyx_pybuffer_x;
20170  PyObject *__pyx_r = NULL;
20171  __Pyx_RefNannyDeclarations
20172  npy_intp __pyx_t_1;
20173  int __pyx_t_2;
20174  npy_intp __pyx_t_3;
20175  int __pyx_t_4;
20176  npy_intp __pyx_t_5;
20177  int __pyx_t_6;
20178  Py_ssize_t __pyx_t_7;
20179  Py_ssize_t __pyx_t_8;
20180  Py_ssize_t __pyx_t_9;
20181  Py_ssize_t __pyx_t_10;
20182  int __pyx_t_11;
20183  Py_ssize_t __pyx_t_12;
20184  Py_ssize_t __pyx_t_13;
20185  Py_ssize_t __pyx_t_14;
20186  Py_ssize_t __pyx_t_15;
20187  Py_ssize_t __pyx_t_16;
20188  Py_ssize_t __pyx_t_17;
20189  Py_ssize_t __pyx_t_18;
20190  Py_ssize_t __pyx_t_19;
20191  Py_ssize_t __pyx_t_20;
20192  Py_ssize_t __pyx_t_21;
20193  Py_ssize_t __pyx_t_22;
20194  Py_ssize_t __pyx_t_23;
20195  Py_ssize_t __pyx_t_24;
20196  Py_ssize_t __pyx_t_25;
20197  Py_ssize_t __pyx_t_26;
20198  Py_ssize_t __pyx_t_27;
20199  Py_ssize_t __pyx_t_28;
20200  Py_ssize_t __pyx_t_29;
20201  Py_ssize_t __pyx_t_30;
20202  Py_ssize_t __pyx_t_31;
20203  Py_ssize_t __pyx_t_32;
20204  Py_ssize_t __pyx_t_33;
20205  Py_ssize_t __pyx_t_34;
20206  Py_ssize_t __pyx_t_35;
20207  Py_ssize_t __pyx_t_36;
20208  Py_ssize_t __pyx_t_37;
20209  Py_ssize_t __pyx_t_38;
20210  Py_ssize_t __pyx_t_39;
20211  __Pyx_RefNannySetupContext("vortexElementVelocityEval4", 0);
20212  __pyx_pybuffer_x.pybuffer.buf = NULL;
20213  __pyx_pybuffer_x.refcount = 0;
20214  __pyx_pybuffernd_x.data = NULL;
20215  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
20216  __pyx_pybuffer_v.pybuffer.buf = NULL;
20217  __pyx_pybuffer_v.refcount = 0;
20218  __pyx_pybuffernd_v.data = NULL;
20219  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
20220  {
20221  __Pyx_BufFmt_StackElem __pyx_stack[1];
20222  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 924, __pyx_L1_error)
20223  }
20224  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
20225  {
20226  __Pyx_BufFmt_StackElem __pyx_stack[1];
20227  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 924, __pyx_L1_error)
20228  }
20229  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_v.diminfo[3].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_v.diminfo[3].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[3];
20230 
20231  /* "subsurfaceTransportFunctions.pyx":929
20232  * cdef int eN,k,ebN
20233  * cdef double pi,one8
20234  * pi = M_PI # <<<<<<<<<<<<<<
20235  * one8 = 1.0/8.0
20236  * for eN in range(x.shape[0]):
20237  */
20238  __pyx_v_pi = M_PI;
20239 
20240  /* "subsurfaceTransportFunctions.pyx":930
20241  * cdef double pi,one8
20242  * pi = M_PI
20243  * one8 = 1.0/8.0 # <<<<<<<<<<<<<<
20244  * for eN in range(x.shape[0]):
20245  * for ebN in range(x.shape[1]):
20246  */
20247  __pyx_v_one8 = (1.0 / 8.0);
20248 
20249  /* "subsurfaceTransportFunctions.pyx":931
20250  * pi = M_PI
20251  * one8 = 1.0/8.0
20252  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
20253  * for ebN in range(x.shape[1]):
20254  * for k in range(x.shape[2]):
20255  */
20256  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
20257  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
20258  __pyx_v_eN = __pyx_t_2;
20259 
20260  /* "subsurfaceTransportFunctions.pyx":932
20261  * one8 = 1.0/8.0
20262  * for eN in range(x.shape[0]):
20263  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
20264  * for k in range(x.shape[2]):
20265  * v[eN,ebN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,0]);
20266  */
20267  __pyx_t_3 = (__pyx_v_x->dimensions[1]);
20268  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
20269  __pyx_v_ebN = __pyx_t_4;
20270 
20271  /* "subsurfaceTransportFunctions.pyx":933
20272  * for eN in range(x.shape[0]):
20273  * for ebN in range(x.shape[1]):
20274  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
20275  * v[eN,ebN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,0]);
20276  * v[eN,ebN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,1]);
20277  */
20278  __pyx_t_5 = (__pyx_v_x->dimensions[2]);
20279  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
20280  __pyx_v_k = __pyx_t_6;
20281 
20282  /* "subsurfaceTransportFunctions.pyx":934
20283  * for ebN in range(x.shape[1]):
20284  * for k in range(x.shape[2]):
20285  * v[eN,ebN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,0]); # <<<<<<<<<<<<<<
20286  * v[eN,ebN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,1]);
20287  *
20288  */
20289  __pyx_t_7 = __pyx_v_eN;
20290  __pyx_t_8 = __pyx_v_ebN;
20291  __pyx_t_9 = __pyx_v_k;
20292  __pyx_t_10 = 1;
20293  __pyx_t_11 = -1;
20294  if (__pyx_t_7 < 0) {
20295  __pyx_t_7 += __pyx_pybuffernd_x.diminfo[0].shape;
20296  if (unlikely(__pyx_t_7 < 0)) __pyx_t_11 = 0;
20297  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
20298  if (__pyx_t_8 < 0) {
20299  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[1].shape;
20300  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 1;
20301  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
20302  if (__pyx_t_9 < 0) {
20303  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[2].shape;
20304  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 2;
20305  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
20306  if (__pyx_t_10 < 0) {
20307  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[3].shape;
20308  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 3;
20309  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_11 = 3;
20310  if (unlikely(__pyx_t_11 != -1)) {
20311  __Pyx_RaiseBufferIndexError(__pyx_t_11);
20312  __PYX_ERR(0, 934, __pyx_L1_error)
20313  }
20314  __pyx_t_12 = __pyx_v_eN;
20315  __pyx_t_13 = __pyx_v_ebN;
20316  __pyx_t_14 = __pyx_v_k;
20317  __pyx_t_15 = 0;
20318  __pyx_t_11 = -1;
20319  if (__pyx_t_12 < 0) {
20320  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[0].shape;
20321  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 0;
20322  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
20323  if (__pyx_t_13 < 0) {
20324  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[1].shape;
20325  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
20326  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
20327  if (__pyx_t_14 < 0) {
20328  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[2].shape;
20329  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 2;
20330  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
20331  if (__pyx_t_15 < 0) {
20332  __pyx_t_15 += __pyx_pybuffernd_x.diminfo[3].shape;
20333  if (unlikely(__pyx_t_15 < 0)) __pyx_t_11 = 3;
20334  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_11 = 3;
20335  if (unlikely(__pyx_t_11 != -1)) {
20336  __Pyx_RaiseBufferIndexError(__pyx_t_11);
20337  __PYX_ERR(0, 934, __pyx_L1_error)
20338  }
20339  __pyx_t_16 = __pyx_v_eN;
20340  __pyx_t_17 = __pyx_v_ebN;
20341  __pyx_t_18 = __pyx_v_k;
20342  __pyx_t_19 = 0;
20343  __pyx_t_11 = -1;
20344  if (__pyx_t_16 < 0) {
20345  __pyx_t_16 += __pyx_pybuffernd_x.diminfo[0].shape;
20346  if (unlikely(__pyx_t_16 < 0)) __pyx_t_11 = 0;
20347  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
20348  if (__pyx_t_17 < 0) {
20349  __pyx_t_17 += __pyx_pybuffernd_x.diminfo[1].shape;
20350  if (unlikely(__pyx_t_17 < 0)) __pyx_t_11 = 1;
20351  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
20352  if (__pyx_t_18 < 0) {
20353  __pyx_t_18 += __pyx_pybuffernd_x.diminfo[2].shape;
20354  if (unlikely(__pyx_t_18 < 0)) __pyx_t_11 = 2;
20355  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
20356  if (__pyx_t_19 < 0) {
20357  __pyx_t_19 += __pyx_pybuffernd_x.diminfo[3].shape;
20358  if (unlikely(__pyx_t_19 < 0)) __pyx_t_11 = 3;
20359  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_11 = 3;
20360  if (unlikely(__pyx_t_11 != -1)) {
20361  __Pyx_RaiseBufferIndexError(__pyx_t_11);
20362  __PYX_ERR(0, 934, __pyx_L1_error)
20363  }
20364  __pyx_t_20 = __pyx_v_eN;
20365  __pyx_t_21 = __pyx_v_ebN;
20366  __pyx_t_22 = __pyx_v_k;
20367  __pyx_t_23 = 0;
20368  __pyx_t_11 = -1;
20369  if (__pyx_t_20 < 0) {
20370  __pyx_t_20 += __pyx_pybuffernd_v.diminfo[0].shape;
20371  if (unlikely(__pyx_t_20 < 0)) __pyx_t_11 = 0;
20372  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
20373  if (__pyx_t_21 < 0) {
20374  __pyx_t_21 += __pyx_pybuffernd_v.diminfo[1].shape;
20375  if (unlikely(__pyx_t_21 < 0)) __pyx_t_11 = 1;
20376  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
20377  if (__pyx_t_22 < 0) {
20378  __pyx_t_22 += __pyx_pybuffernd_v.diminfo[2].shape;
20379  if (unlikely(__pyx_t_22 < 0)) __pyx_t_11 = 2;
20380  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
20381  if (__pyx_t_23 < 0) {
20382  __pyx_t_23 += __pyx_pybuffernd_v.diminfo[3].shape;
20383  if (unlikely(__pyx_t_23 < 0)) __pyx_t_11 = 3;
20384  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_11 = 3;
20385  if (unlikely(__pyx_t_11 != -1)) {
20386  __Pyx_RaiseBufferIndexError(__pyx_t_11);
20387  __PYX_ERR(0, 934, __pyx_L1_error)
20388  }
20389  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_22, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_23, __pyx_pybuffernd_v.diminfo[3].strides) = (((cos(((__pyx_v_pi * __pyx_v_one8) * __pyx_v_t)) * sin(((2.0 * __pyx_v_pi) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[3].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_15, __pyx_pybuffernd_x.diminfo[3].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_19, __pyx_pybuffernd_x.diminfo[3].strides)))));
20390 
20391  /* "subsurfaceTransportFunctions.pyx":935
20392  * for k in range(x.shape[2]):
20393  * v[eN,ebN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,0]);
20394  * v[eN,ebN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,1]); # <<<<<<<<<<<<<<
20395  *
20396  *
20397  */
20398  __pyx_t_24 = __pyx_v_eN;
20399  __pyx_t_25 = __pyx_v_ebN;
20400  __pyx_t_26 = __pyx_v_k;
20401  __pyx_t_27 = 0;
20402  __pyx_t_11 = -1;
20403  if (__pyx_t_24 < 0) {
20404  __pyx_t_24 += __pyx_pybuffernd_x.diminfo[0].shape;
20405  if (unlikely(__pyx_t_24 < 0)) __pyx_t_11 = 0;
20406  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
20407  if (__pyx_t_25 < 0) {
20408  __pyx_t_25 += __pyx_pybuffernd_x.diminfo[1].shape;
20409  if (unlikely(__pyx_t_25 < 0)) __pyx_t_11 = 1;
20410  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
20411  if (__pyx_t_26 < 0) {
20412  __pyx_t_26 += __pyx_pybuffernd_x.diminfo[2].shape;
20413  if (unlikely(__pyx_t_26 < 0)) __pyx_t_11 = 2;
20414  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
20415  if (__pyx_t_27 < 0) {
20416  __pyx_t_27 += __pyx_pybuffernd_x.diminfo[3].shape;
20417  if (unlikely(__pyx_t_27 < 0)) __pyx_t_11 = 3;
20418  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_11 = 3;
20419  if (unlikely(__pyx_t_11 != -1)) {
20420  __Pyx_RaiseBufferIndexError(__pyx_t_11);
20421  __PYX_ERR(0, 935, __pyx_L1_error)
20422  }
20423  __pyx_t_28 = __pyx_v_eN;
20424  __pyx_t_29 = __pyx_v_ebN;
20425  __pyx_t_30 = __pyx_v_k;
20426  __pyx_t_31 = 1;
20427  __pyx_t_11 = -1;
20428  if (__pyx_t_28 < 0) {
20429  __pyx_t_28 += __pyx_pybuffernd_x.diminfo[0].shape;
20430  if (unlikely(__pyx_t_28 < 0)) __pyx_t_11 = 0;
20431  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
20432  if (__pyx_t_29 < 0) {
20433  __pyx_t_29 += __pyx_pybuffernd_x.diminfo[1].shape;
20434  if (unlikely(__pyx_t_29 < 0)) __pyx_t_11 = 1;
20435  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
20436  if (__pyx_t_30 < 0) {
20437  __pyx_t_30 += __pyx_pybuffernd_x.diminfo[2].shape;
20438  if (unlikely(__pyx_t_30 < 0)) __pyx_t_11 = 2;
20439  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
20440  if (__pyx_t_31 < 0) {
20441  __pyx_t_31 += __pyx_pybuffernd_x.diminfo[3].shape;
20442  if (unlikely(__pyx_t_31 < 0)) __pyx_t_11 = 3;
20443  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_11 = 3;
20444  if (unlikely(__pyx_t_11 != -1)) {
20445  __Pyx_RaiseBufferIndexError(__pyx_t_11);
20446  __PYX_ERR(0, 935, __pyx_L1_error)
20447  }
20448  __pyx_t_32 = __pyx_v_eN;
20449  __pyx_t_33 = __pyx_v_ebN;
20450  __pyx_t_34 = __pyx_v_k;
20451  __pyx_t_35 = 1;
20452  __pyx_t_11 = -1;
20453  if (__pyx_t_32 < 0) {
20454  __pyx_t_32 += __pyx_pybuffernd_x.diminfo[0].shape;
20455  if (unlikely(__pyx_t_32 < 0)) __pyx_t_11 = 0;
20456  } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
20457  if (__pyx_t_33 < 0) {
20458  __pyx_t_33 += __pyx_pybuffernd_x.diminfo[1].shape;
20459  if (unlikely(__pyx_t_33 < 0)) __pyx_t_11 = 1;
20460  } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
20461  if (__pyx_t_34 < 0) {
20462  __pyx_t_34 += __pyx_pybuffernd_x.diminfo[2].shape;
20463  if (unlikely(__pyx_t_34 < 0)) __pyx_t_11 = 2;
20464  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
20465  if (__pyx_t_35 < 0) {
20466  __pyx_t_35 += __pyx_pybuffernd_x.diminfo[3].shape;
20467  if (unlikely(__pyx_t_35 < 0)) __pyx_t_11 = 3;
20468  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_11 = 3;
20469  if (unlikely(__pyx_t_11 != -1)) {
20470  __Pyx_RaiseBufferIndexError(__pyx_t_11);
20471  __PYX_ERR(0, 935, __pyx_L1_error)
20472  }
20473  __pyx_t_36 = __pyx_v_eN;
20474  __pyx_t_37 = __pyx_v_ebN;
20475  __pyx_t_38 = __pyx_v_k;
20476  __pyx_t_39 = 1;
20477  __pyx_t_11 = -1;
20478  if (__pyx_t_36 < 0) {
20479  __pyx_t_36 += __pyx_pybuffernd_v.diminfo[0].shape;
20480  if (unlikely(__pyx_t_36 < 0)) __pyx_t_11 = 0;
20481  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
20482  if (__pyx_t_37 < 0) {
20483  __pyx_t_37 += __pyx_pybuffernd_v.diminfo[1].shape;
20484  if (unlikely(__pyx_t_37 < 0)) __pyx_t_11 = 1;
20485  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
20486  if (__pyx_t_38 < 0) {
20487  __pyx_t_38 += __pyx_pybuffernd_v.diminfo[2].shape;
20488  if (unlikely(__pyx_t_38 < 0)) __pyx_t_11 = 2;
20489  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
20490  if (__pyx_t_39 < 0) {
20491  __pyx_t_39 += __pyx_pybuffernd_v.diminfo[3].shape;
20492  if (unlikely(__pyx_t_39 < 0)) __pyx_t_11 = 3;
20493  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_11 = 3;
20494  if (unlikely(__pyx_t_11 != -1)) {
20495  __Pyx_RaiseBufferIndexError(__pyx_t_11);
20496  __PYX_ERR(0, 935, __pyx_L1_error)
20497  }
20498  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_38, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_39, __pyx_pybuffernd_v.diminfo[3].strides) = ((((-cos(((__pyx_v_pi * __pyx_v_one8) * __pyx_v_t))) * sin(((2.0 * __pyx_v_pi) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_26, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_27, __pyx_pybuffernd_x.diminfo[3].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_30, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_31, __pyx_pybuffernd_x.diminfo[3].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_34, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_35, __pyx_pybuffernd_x.diminfo[3].strides)))));
20499  }
20500  }
20501  }
20502 
20503  /* "subsurfaceTransportFunctions.pyx":924
20504  *
20505  *
20506  * def vortexElementVelocityEval4(double t, # <<<<<<<<<<<<<<
20507  * numpy.ndarray[DTYPE_t,ndim=4] x,
20508  * numpy.ndarray[DTYPE_t,ndim=4] v):
20509  */
20510 
20511  /* function exit code */
20512  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20513  goto __pyx_L0;
20514  __pyx_L1_error:;
20515  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
20516  __Pyx_PyThreadState_declare
20517  __Pyx_PyThreadState_assign
20518  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
20519  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
20520  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
20521  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
20522  __Pyx_AddTraceback("subsurfaceTransportFunctions.vortexElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
20523  __pyx_r = NULL;
20524  goto __pyx_L2;
20525  __pyx_L0:;
20526  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
20527  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
20528  __pyx_L2:;
20529  __Pyx_XGIVEREF(__pyx_r);
20530  __Pyx_RefNannyFinishContext();
20531  return __pyx_r;
20532 }
20533 
20534 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":197
20535  * # experimental exception made for __getbuffer__ and __releasebuffer__
20536  * # -- the details of this may change.
20537  * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
20538  * # This implementation of getbuffer is geared towards Cython
20539  * # requirements, and does not yet fullfill the PEP.
20540  */
20541 
20542 /* Python wrapper */
20543 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
20544 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
20545  int __pyx_r;
20546  __Pyx_RefNannyDeclarations
20547  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
20548  __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
20549 
20550  /* function exit code */
20551  __Pyx_RefNannyFinishContext();
20552  return __pyx_r;
20553 }
20554 
20555 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
20556  int __pyx_v_copy_shape;
20557  int __pyx_v_i;
20558  int __pyx_v_ndim;
20559  int __pyx_v_endian_detector;
20560  int __pyx_v_little_endian;
20561  int __pyx_v_t;
20562  char *__pyx_v_f;
20563  PyArray_Descr *__pyx_v_descr = 0;
20564  int __pyx_v_offset;
20565  int __pyx_v_hasfields;
20566  int __pyx_r;
20567  __Pyx_RefNannyDeclarations
20568  int __pyx_t_1;
20569  int __pyx_t_2;
20570  PyObject *__pyx_t_3 = NULL;
20571  int __pyx_t_4;
20572  int __pyx_t_5;
20573  PyObject *__pyx_t_6 = NULL;
20574  char *__pyx_t_7;
20575  __Pyx_RefNannySetupContext("__getbuffer__", 0);
20576  if (__pyx_v_info != NULL) {
20577  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
20578  __Pyx_GIVEREF(__pyx_v_info->obj);
20579  }
20580 
20581  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":203
20582  * # of flags
20583  *
20584  * if info == NULL: return # <<<<<<<<<<<<<<
20585  *
20586  * cdef int copy_shape, i, ndim
20587  */
20588  __pyx_t_1 = ((__pyx_v_info == NULL) != 0);
20589  if (__pyx_t_1) {
20590  __pyx_r = 0;
20591  goto __pyx_L0;
20592  }
20593 
20594  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":206
20595  *
20596  * cdef int copy_shape, i, ndim
20597  * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
20598  * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
20599  *
20600  */
20601  __pyx_v_endian_detector = 1;
20602 
20603  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":207
20604  * cdef int copy_shape, i, ndim
20605  * cdef int endian_detector = 1
20606  * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
20607  *
20608  * ndim = PyArray_NDIM(self)
20609  */
20610  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
20611 
20612  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":209
20613  * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
20614  *
20615  * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<<
20616  *
20617  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
20618  */
20619  __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
20620 
20621  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":211
20622  * ndim = PyArray_NDIM(self)
20623  *
20624  * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
20625  * copy_shape = 1
20626  * else:
20627  */
20628  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
20629  if (__pyx_t_1) {
20630 
20631  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":212
20632  *
20633  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
20634  * copy_shape = 1 # <<<<<<<<<<<<<<
20635  * else:
20636  * copy_shape = 0
20637  */
20638  __pyx_v_copy_shape = 1;
20639 
20640  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":211
20641  * ndim = PyArray_NDIM(self)
20642  *
20643  * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
20644  * copy_shape = 1
20645  * else:
20646  */
20647  goto __pyx_L4;
20648  }
20649 
20650  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":214
20651  * copy_shape = 1
20652  * else:
20653  * copy_shape = 0 # <<<<<<<<<<<<<<
20654  *
20655  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
20656  */
20657  /*else*/ {
20658  __pyx_v_copy_shape = 0;
20659  }
20660  __pyx_L4:;
20661 
20662  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":216
20663  * copy_shape = 0
20664  *
20665  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
20666  * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
20667  * raise ValueError(u"ndarray is not C contiguous")
20668  */
20669  __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
20670  if (__pyx_t_2) {
20671  } else {
20672  __pyx_t_1 = __pyx_t_2;
20673  goto __pyx_L6_bool_binop_done;
20674  }
20675 
20676  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":217
20677  *
20678  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
20679  * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<<
20680  * raise ValueError(u"ndarray is not C contiguous")
20681  *
20682  */
20683  __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0);
20684  __pyx_t_1 = __pyx_t_2;
20685  __pyx_L6_bool_binop_done:;
20686 
20687  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":216
20688  * copy_shape = 0
20689  *
20690  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
20691  * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
20692  * raise ValueError(u"ndarray is not C contiguous")
20693  */
20694  if (__pyx_t_1) {
20695 
20696  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":218
20697  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
20698  * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
20699  * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
20700  *
20701  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
20702  */
20703  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 218, __pyx_L1_error)
20704  __Pyx_GOTREF(__pyx_t_3);
20705  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
20706  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20707  __PYX_ERR(1, 218, __pyx_L1_error)
20708 
20709  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":216
20710  * copy_shape = 0
20711  *
20712  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
20713  * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
20714  * raise ValueError(u"ndarray is not C contiguous")
20715  */
20716  }
20717 
20718  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":220
20719  * raise ValueError(u"ndarray is not C contiguous")
20720  *
20721  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
20722  * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
20723  * raise ValueError(u"ndarray is not Fortran contiguous")
20724  */
20725  __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
20726  if (__pyx_t_2) {
20727  } else {
20728  __pyx_t_1 = __pyx_t_2;
20729  goto __pyx_L9_bool_binop_done;
20730  }
20731 
20732  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":221
20733  *
20734  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
20735  * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<<
20736  * raise ValueError(u"ndarray is not Fortran contiguous")
20737  *
20738  */
20739  __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0);
20740  __pyx_t_1 = __pyx_t_2;
20741  __pyx_L9_bool_binop_done:;
20742 
20743  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":220
20744  * raise ValueError(u"ndarray is not C contiguous")
20745  *
20746  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
20747  * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
20748  * raise ValueError(u"ndarray is not Fortran contiguous")
20749  */
20750  if (__pyx_t_1) {
20751 
20752  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":222
20753  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
20754  * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
20755  * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
20756  *
20757  * info.buf = PyArray_DATA(self)
20758  */
20759  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 222, __pyx_L1_error)
20760  __Pyx_GOTREF(__pyx_t_3);
20761  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
20762  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20763  __PYX_ERR(1, 222, __pyx_L1_error)
20764 
20765  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":220
20766  * raise ValueError(u"ndarray is not C contiguous")
20767  *
20768  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
20769  * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
20770  * raise ValueError(u"ndarray is not Fortran contiguous")
20771  */
20772  }
20773 
20774  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":224
20775  * raise ValueError(u"ndarray is not Fortran contiguous")
20776  *
20777  * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<<
20778  * info.ndim = ndim
20779  * if copy_shape:
20780  */
20781  __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
20782 
20783  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":225
20784  *
20785  * info.buf = PyArray_DATA(self)
20786  * info.ndim = ndim # <<<<<<<<<<<<<<
20787  * if copy_shape:
20788  * # Allocate new buffer for strides and shape info.
20789  */
20790  __pyx_v_info->ndim = __pyx_v_ndim;
20791 
20792  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":226
20793  * info.buf = PyArray_DATA(self)
20794  * info.ndim = ndim
20795  * if copy_shape: # <<<<<<<<<<<<<<
20796  * # Allocate new buffer for strides and shape info.
20797  * # This is allocated as one block, strides first.
20798  */
20799  __pyx_t_1 = (__pyx_v_copy_shape != 0);
20800  if (__pyx_t_1) {
20801 
20802  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":229
20803  * # Allocate new buffer for strides and shape info.
20804  * # This is allocated as one block, strides first.
20805  * info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2) # <<<<<<<<<<<<<<
20806  * info.shape = info.strides + ndim
20807  * for i in range(ndim):
20808  */
20809  __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2)));
20810 
20811  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":230
20812  * # This is allocated as one block, strides first.
20813  * info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
20814  * info.shape = info.strides + ndim # <<<<<<<<<<<<<<
20815  * for i in range(ndim):
20816  * info.strides[i] = PyArray_STRIDES(self)[i]
20817  */
20818  __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
20819 
20820  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":231
20821  * info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
20822  * info.shape = info.strides + ndim
20823  * for i in range(ndim): # <<<<<<<<<<<<<<
20824  * info.strides[i] = PyArray_STRIDES(self)[i]
20825  * info.shape[i] = PyArray_DIMS(self)[i]
20826  */
20827  __pyx_t_4 = __pyx_v_ndim;
20828  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
20829  __pyx_v_i = __pyx_t_5;
20830 
20831  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":232
20832  * info.shape = info.strides + ndim
20833  * for i in range(ndim):
20834  * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<<
20835  * info.shape[i] = PyArray_DIMS(self)[i]
20836  * else:
20837  */
20838  (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
20839 
20840  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":233
20841  * for i in range(ndim):
20842  * info.strides[i] = PyArray_STRIDES(self)[i]
20843  * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<<
20844  * else:
20845  * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
20846  */
20847  (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
20848  }
20849 
20850  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":226
20851  * info.buf = PyArray_DATA(self)
20852  * info.ndim = ndim
20853  * if copy_shape: # <<<<<<<<<<<<<<
20854  * # Allocate new buffer for strides and shape info.
20855  * # This is allocated as one block, strides first.
20856  */
20857  goto __pyx_L11;
20858  }
20859 
20860  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":235
20861  * info.shape[i] = PyArray_DIMS(self)[i]
20862  * else:
20863  * info.strides = <Py_ssize_t*>PyArray_STRIDES(self) # <<<<<<<<<<<<<<
20864  * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
20865  * info.suboffsets = NULL
20866  */
20867  /*else*/ {
20868  __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
20869 
20870  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":236
20871  * else:
20872  * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
20873  * info.shape = <Py_ssize_t*>PyArray_DIMS(self) # <<<<<<<<<<<<<<
20874  * info.suboffsets = NULL
20875  * info.itemsize = PyArray_ITEMSIZE(self)
20876  */
20877  __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
20878  }
20879  __pyx_L11:;
20880 
20881  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":237
20882  * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
20883  * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
20884  * info.suboffsets = NULL # <<<<<<<<<<<<<<
20885  * info.itemsize = PyArray_ITEMSIZE(self)
20886  * info.readonly = not PyArray_ISWRITEABLE(self)
20887  */
20888  __pyx_v_info->suboffsets = NULL;
20889 
20890  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":238
20891  * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
20892  * info.suboffsets = NULL
20893  * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<<
20894  * info.readonly = not PyArray_ISWRITEABLE(self)
20895  *
20896  */
20897  __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
20898 
20899  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":239
20900  * info.suboffsets = NULL
20901  * info.itemsize = PyArray_ITEMSIZE(self)
20902  * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<<
20903  *
20904  * cdef int t
20905  */
20906  __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
20907 
20908  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":242
20909  *
20910  * cdef int t
20911  * cdef char* f = NULL # <<<<<<<<<<<<<<
20912  * cdef dtype descr = self.descr
20913  * cdef int offset
20914  */
20915  __pyx_v_f = NULL;
20916 
20917  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":243
20918  * cdef int t
20919  * cdef char* f = NULL
20920  * cdef dtype descr = self.descr # <<<<<<<<<<<<<<
20921  * cdef int offset
20922  *
20923  */
20924  __pyx_t_3 = ((PyObject *)__pyx_v_self->descr);
20925  __Pyx_INCREF(__pyx_t_3);
20926  __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
20927  __pyx_t_3 = 0;
20928 
20929  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":246
20930  * cdef int offset
20931  *
20932  * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<<
20933  *
20934  * if not hasfields and not copy_shape:
20935  */
20936  __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);
20937 
20938  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":248
20939  * cdef bint hasfields = PyDataType_HASFIELDS(descr)
20940  *
20941  * if not hasfields and not copy_shape: # <<<<<<<<<<<<<<
20942  * # do not call releasebuffer
20943  * info.obj = None
20944  */
20945  __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0);
20946  if (__pyx_t_2) {
20947  } else {
20948  __pyx_t_1 = __pyx_t_2;
20949  goto __pyx_L15_bool_binop_done;
20950  }
20951  __pyx_t_2 = ((!(__pyx_v_copy_shape != 0)) != 0);
20952  __pyx_t_1 = __pyx_t_2;
20953  __pyx_L15_bool_binop_done:;
20954  if (__pyx_t_1) {
20955 
20956  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":250
20957  * if not hasfields and not copy_shape:
20958  * # do not call releasebuffer
20959  * info.obj = None # <<<<<<<<<<<<<<
20960  * else:
20961  * # need to call releasebuffer
20962  */
20963  __Pyx_INCREF(Py_None);
20964  __Pyx_GIVEREF(Py_None);
20965  __Pyx_GOTREF(__pyx_v_info->obj);
20966  __Pyx_DECREF(__pyx_v_info->obj);
20967  __pyx_v_info->obj = Py_None;
20968 
20969  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":248
20970  * cdef bint hasfields = PyDataType_HASFIELDS(descr)
20971  *
20972  * if not hasfields and not copy_shape: # <<<<<<<<<<<<<<
20973  * # do not call releasebuffer
20974  * info.obj = None
20975  */
20976  goto __pyx_L14;
20977  }
20978 
20979  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":253
20980  * else:
20981  * # need to call releasebuffer
20982  * info.obj = self # <<<<<<<<<<<<<<
20983  *
20984  * if not hasfields:
20985  */
20986  /*else*/ {
20987  __Pyx_INCREF(((PyObject *)__pyx_v_self));
20988  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
20989  __Pyx_GOTREF(__pyx_v_info->obj);
20990  __Pyx_DECREF(__pyx_v_info->obj);
20991  __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
20992  }
20993  __pyx_L14:;
20994 
20995  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":255
20996  * info.obj = self
20997  *
20998  * if not hasfields: # <<<<<<<<<<<<<<
20999  * t = descr.type_num
21000  * if ((descr.byteorder == c'>' and little_endian) or
21001  */
21002  __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0);
21003  if (__pyx_t_1) {
21004 
21005  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":256
21006  *
21007  * if not hasfields:
21008  * t = descr.type_num # <<<<<<<<<<<<<<
21009  * if ((descr.byteorder == c'>' and little_endian) or
21010  * (descr.byteorder == c'<' and not little_endian)):
21011  */
21012  __pyx_t_4 = __pyx_v_descr->type_num;
21013  __pyx_v_t = __pyx_t_4;
21014 
21015  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":257
21016  * if not hasfields:
21017  * t = descr.type_num
21018  * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
21019  * (descr.byteorder == c'<' and not little_endian)):
21020  * raise ValueError(u"Non-native byte order not supported")
21021  */
21022  __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
21023  if (!__pyx_t_2) {
21024  goto __pyx_L20_next_or;
21025  } else {
21026  }
21027  __pyx_t_2 = (__pyx_v_little_endian != 0);
21028  if (!__pyx_t_2) {
21029  } else {
21030  __pyx_t_1 = __pyx_t_2;
21031  goto __pyx_L19_bool_binop_done;
21032  }
21033  __pyx_L20_next_or:;
21034 
21035  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":258
21036  * t = descr.type_num
21037  * if ((descr.byteorder == c'>' and little_endian) or
21038  * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
21039  * raise ValueError(u"Non-native byte order not supported")
21040  * if t == NPY_BYTE: f = "b"
21041  */
21042  __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
21043  if (__pyx_t_2) {
21044  } else {
21045  __pyx_t_1 = __pyx_t_2;
21046  goto __pyx_L19_bool_binop_done;
21047  }
21048  __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
21049  __pyx_t_1 = __pyx_t_2;
21050  __pyx_L19_bool_binop_done:;
21051 
21052  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":257
21053  * if not hasfields:
21054  * t = descr.type_num
21055  * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
21056  * (descr.byteorder == c'<' and not little_endian)):
21057  * raise ValueError(u"Non-native byte order not supported")
21058  */
21059  if (__pyx_t_1) {
21060 
21061  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":259
21062  * if ((descr.byteorder == c'>' and little_endian) or
21063  * (descr.byteorder == c'<' and not little_endian)):
21064  * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
21065  * if t == NPY_BYTE: f = "b"
21066  * elif t == NPY_UBYTE: f = "B"
21067  */
21068  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 259, __pyx_L1_error)
21069  __Pyx_GOTREF(__pyx_t_3);
21070  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
21071  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21072  __PYX_ERR(1, 259, __pyx_L1_error)
21073 
21074  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":257
21075  * if not hasfields:
21076  * t = descr.type_num
21077  * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
21078  * (descr.byteorder == c'<' and not little_endian)):
21079  * raise ValueError(u"Non-native byte order not supported")
21080  */
21081  }
21082 
21083  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":260
21084  * (descr.byteorder == c'<' and not little_endian)):
21085  * raise ValueError(u"Non-native byte order not supported")
21086  * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<<
21087  * elif t == NPY_UBYTE: f = "B"
21088  * elif t == NPY_SHORT: f = "h"
21089  */
21090  switch (__pyx_v_t) {
21091  case NPY_BYTE:
21092  __pyx_v_f = ((char *)"b");
21093  break;
21094 
21095  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":261
21096  * raise ValueError(u"Non-native byte order not supported")
21097  * if t == NPY_BYTE: f = "b"
21098  * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<<
21099  * elif t == NPY_SHORT: f = "h"
21100  * elif t == NPY_USHORT: f = "H"
21101  */
21102  case NPY_UBYTE:
21103  __pyx_v_f = ((char *)"B");
21104  break;
21105 
21106  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":262
21107  * if t == NPY_BYTE: f = "b"
21108  * elif t == NPY_UBYTE: f = "B"
21109  * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<<
21110  * elif t == NPY_USHORT: f = "H"
21111  * elif t == NPY_INT: f = "i"
21112  */
21113  case NPY_SHORT:
21114  __pyx_v_f = ((char *)"h");
21115  break;
21116 
21117  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":263
21118  * elif t == NPY_UBYTE: f = "B"
21119  * elif t == NPY_SHORT: f = "h"
21120  * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<<
21121  * elif t == NPY_INT: f = "i"
21122  * elif t == NPY_UINT: f = "I"
21123  */
21124  case NPY_USHORT:
21125  __pyx_v_f = ((char *)"H");
21126  break;
21127 
21128  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":264
21129  * elif t == NPY_SHORT: f = "h"
21130  * elif t == NPY_USHORT: f = "H"
21131  * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<<
21132  * elif t == NPY_UINT: f = "I"
21133  * elif t == NPY_LONG: f = "l"
21134  */
21135  case NPY_INT:
21136  __pyx_v_f = ((char *)"i");
21137  break;
21138 
21139  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":265
21140  * elif t == NPY_USHORT: f = "H"
21141  * elif t == NPY_INT: f = "i"
21142  * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<<
21143  * elif t == NPY_LONG: f = "l"
21144  * elif t == NPY_ULONG: f = "L"
21145  */
21146  case NPY_UINT:
21147  __pyx_v_f = ((char *)"I");
21148  break;
21149 
21150  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":266
21151  * elif t == NPY_INT: f = "i"
21152  * elif t == NPY_UINT: f = "I"
21153  * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<<
21154  * elif t == NPY_ULONG: f = "L"
21155  * elif t == NPY_LONGLONG: f = "q"
21156  */
21157  case NPY_LONG:
21158  __pyx_v_f = ((char *)"l");
21159  break;
21160 
21161  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":267
21162  * elif t == NPY_UINT: f = "I"
21163  * elif t == NPY_LONG: f = "l"
21164  * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<<
21165  * elif t == NPY_LONGLONG: f = "q"
21166  * elif t == NPY_ULONGLONG: f = "Q"
21167  */
21168  case NPY_ULONG:
21169  __pyx_v_f = ((char *)"L");
21170  break;
21171 
21172  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":268
21173  * elif t == NPY_LONG: f = "l"
21174  * elif t == NPY_ULONG: f = "L"
21175  * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<<
21176  * elif t == NPY_ULONGLONG: f = "Q"
21177  * elif t == NPY_FLOAT: f = "f"
21178  */
21179  case NPY_LONGLONG:
21180  __pyx_v_f = ((char *)"q");
21181  break;
21182 
21183  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":269
21184  * elif t == NPY_ULONG: f = "L"
21185  * elif t == NPY_LONGLONG: f = "q"
21186  * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<<
21187  * elif t == NPY_FLOAT: f = "f"
21188  * elif t == NPY_DOUBLE: f = "d"
21189  */
21190  case NPY_ULONGLONG:
21191  __pyx_v_f = ((char *)"Q");
21192  break;
21193 
21194  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":270
21195  * elif t == NPY_LONGLONG: f = "q"
21196  * elif t == NPY_ULONGLONG: f = "Q"
21197  * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<<
21198  * elif t == NPY_DOUBLE: f = "d"
21199  * elif t == NPY_LONGDOUBLE: f = "g"
21200  */
21201  case NPY_FLOAT:
21202  __pyx_v_f = ((char *)"f");
21203  break;
21204 
21205  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":271
21206  * elif t == NPY_ULONGLONG: f = "Q"
21207  * elif t == NPY_FLOAT: f = "f"
21208  * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<<
21209  * elif t == NPY_LONGDOUBLE: f = "g"
21210  * elif t == NPY_CFLOAT: f = "Zf"
21211  */
21212  case NPY_DOUBLE:
21213  __pyx_v_f = ((char *)"d");
21214  break;
21215 
21216  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":272
21217  * elif t == NPY_FLOAT: f = "f"
21218  * elif t == NPY_DOUBLE: f = "d"
21219  * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<<
21220  * elif t == NPY_CFLOAT: f = "Zf"
21221  * elif t == NPY_CDOUBLE: f = "Zd"
21222  */
21223  case NPY_LONGDOUBLE:
21224  __pyx_v_f = ((char *)"g");
21225  break;
21226 
21227  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":273
21228  * elif t == NPY_DOUBLE: f = "d"
21229  * elif t == NPY_LONGDOUBLE: f = "g"
21230  * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<<
21231  * elif t == NPY_CDOUBLE: f = "Zd"
21232  * elif t == NPY_CLONGDOUBLE: f = "Zg"
21233  */
21234  case NPY_CFLOAT:
21235  __pyx_v_f = ((char *)"Zf");
21236  break;
21237 
21238  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":274
21239  * elif t == NPY_LONGDOUBLE: f = "g"
21240  * elif t == NPY_CFLOAT: f = "Zf"
21241  * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<<
21242  * elif t == NPY_CLONGDOUBLE: f = "Zg"
21243  * elif t == NPY_OBJECT: f = "O"
21244  */
21245  case NPY_CDOUBLE:
21246  __pyx_v_f = ((char *)"Zd");
21247  break;
21248 
21249  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":275
21250  * elif t == NPY_CFLOAT: f = "Zf"
21251  * elif t == NPY_CDOUBLE: f = "Zd"
21252  * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<<
21253  * elif t == NPY_OBJECT: f = "O"
21254  * else:
21255  */
21256  case NPY_CLONGDOUBLE:
21257  __pyx_v_f = ((char *)"Zg");
21258  break;
21259 
21260  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":276
21261  * elif t == NPY_CDOUBLE: f = "Zd"
21262  * elif t == NPY_CLONGDOUBLE: f = "Zg"
21263  * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<<
21264  * else:
21265  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
21266  */
21267  case NPY_OBJECT:
21268  __pyx_v_f = ((char *)"O");
21269  break;
21270  default:
21271 
21272  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":278
21273  * elif t == NPY_OBJECT: f = "O"
21274  * else:
21275  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
21276  * info.format = f
21277  * return
21278  */
21279  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 278, __pyx_L1_error)
21280  __Pyx_GOTREF(__pyx_t_3);
21281  __pyx_t_6 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 278, __pyx_L1_error)
21282  __Pyx_GOTREF(__pyx_t_6);
21283  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21284  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 278, __pyx_L1_error)
21285  __Pyx_GOTREF(__pyx_t_3);
21286  __Pyx_GIVEREF(__pyx_t_6);
21287  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
21288  __pyx_t_6 = 0;
21289  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 278, __pyx_L1_error)
21290  __Pyx_GOTREF(__pyx_t_6);
21291  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21292  __Pyx_Raise(__pyx_t_6, 0, 0, 0);
21293  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
21294  __PYX_ERR(1, 278, __pyx_L1_error)
21295  break;
21296  }
21297 
21298  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":279
21299  * else:
21300  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
21301  * info.format = f # <<<<<<<<<<<<<<
21302  * return
21303  * else:
21304  */
21305  __pyx_v_info->format = __pyx_v_f;
21306 
21307  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":280
21308  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
21309  * info.format = f
21310  * return # <<<<<<<<<<<<<<
21311  * else:
21312  * info.format = <char*>stdlib.malloc(_buffer_format_string_len)
21313  */
21314  __pyx_r = 0;
21315  goto __pyx_L0;
21316 
21317  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":255
21318  * info.obj = self
21319  *
21320  * if not hasfields: # <<<<<<<<<<<<<<
21321  * t = descr.type_num
21322  * if ((descr.byteorder == c'>' and little_endian) or
21323  */
21324  }
21325 
21326  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":282
21327  * return
21328  * else:
21329  * info.format = <char*>stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<<
21330  * info.format[0] = c'^' # Native data types, manual alignment
21331  * offset = 0
21332  */
21333  /*else*/ {
21334  __pyx_v_info->format = ((char *)malloc(0xFF));
21335 
21336  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":283
21337  * else:
21338  * info.format = <char*>stdlib.malloc(_buffer_format_string_len)
21339  * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<<
21340  * offset = 0
21341  * f = _util_dtypestring(descr, info.format + 1,
21342  */
21343  (__pyx_v_info->format[0]) = '^';
21344 
21345  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":284
21346  * info.format = <char*>stdlib.malloc(_buffer_format_string_len)
21347  * info.format[0] = c'^' # Native data types, manual alignment
21348  * offset = 0 # <<<<<<<<<<<<<<
21349  * f = _util_dtypestring(descr, info.format + 1,
21350  * info.format + _buffer_format_string_len,
21351  */
21352  __pyx_v_offset = 0;
21353 
21354  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":285
21355  * info.format[0] = c'^' # Native data types, manual alignment
21356  * offset = 0
21357  * f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<<
21358  * info.format + _buffer_format_string_len,
21359  * &offset)
21360  */
21361  __pyx_t_7 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_7 == NULL)) __PYX_ERR(1, 285, __pyx_L1_error)
21362  __pyx_v_f = __pyx_t_7;
21363 
21364  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":288
21365  * info.format + _buffer_format_string_len,
21366  * &offset)
21367  * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<<
21368  *
21369  * def __releasebuffer__(ndarray self, Py_buffer* info):
21370  */
21371  (__pyx_v_f[0]) = '\x00';
21372  }
21373 
21374  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":197
21375  * # experimental exception made for __getbuffer__ and __releasebuffer__
21376  * # -- the details of this may change.
21377  * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
21378  * # This implementation of getbuffer is geared towards Cython
21379  * # requirements, and does not yet fullfill the PEP.
21380  */
21381 
21382  /* function exit code */
21383  __pyx_r = 0;
21384  goto __pyx_L0;
21385  __pyx_L1_error:;
21386  __Pyx_XDECREF(__pyx_t_3);
21387  __Pyx_XDECREF(__pyx_t_6);
21388  __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
21389  __pyx_r = -1;
21390  if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
21391  __Pyx_GOTREF(__pyx_v_info->obj);
21392  __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
21393  }
21394  goto __pyx_L2;
21395  __pyx_L0:;
21396  if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
21397  __Pyx_GOTREF(Py_None);
21398  __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
21399  }
21400  __pyx_L2:;
21401  __Pyx_XDECREF((PyObject *)__pyx_v_descr);
21402  __Pyx_RefNannyFinishContext();
21403  return __pyx_r;
21404 }
21405 
21406 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":290
21407  * f[0] = c'\0' # Terminate format string
21408  *
21409  * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
21410  * if PyArray_HASFIELDS(self):
21411  * stdlib.free(info.format)
21412  */
21413 
21414 /* Python wrapper */
21415 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
21416 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
21417  __Pyx_RefNannyDeclarations
21418  __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
21419  __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
21420 
21421  /* function exit code */
21422  __Pyx_RefNannyFinishContext();
21423 }
21424 
21425 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
21426  __Pyx_RefNannyDeclarations
21427  int __pyx_t_1;
21428  __Pyx_RefNannySetupContext("__releasebuffer__", 0);
21429 
21430  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":291
21431  *
21432  * def __releasebuffer__(ndarray self, Py_buffer* info):
21433  * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
21434  * stdlib.free(info.format)
21435  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
21436  */
21437  __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
21438  if (__pyx_t_1) {
21439 
21440  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":292
21441  * def __releasebuffer__(ndarray self, Py_buffer* info):
21442  * if PyArray_HASFIELDS(self):
21443  * stdlib.free(info.format) # <<<<<<<<<<<<<<
21444  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
21445  * stdlib.free(info.strides)
21446  */
21447  free(__pyx_v_info->format);
21448 
21449  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":291
21450  *
21451  * def __releasebuffer__(ndarray self, Py_buffer* info):
21452  * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
21453  * stdlib.free(info.format)
21454  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
21455  */
21456  }
21457 
21458  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":293
21459  * if PyArray_HASFIELDS(self):
21460  * stdlib.free(info.format)
21461  * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
21462  * stdlib.free(info.strides)
21463  * # info.shape was stored after info.strides in the same block
21464  */
21465  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
21466  if (__pyx_t_1) {
21467 
21468  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":294
21469  * stdlib.free(info.format)
21470  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
21471  * stdlib.free(info.strides) # <<<<<<<<<<<<<<
21472  * # info.shape was stored after info.strides in the same block
21473  *
21474  */
21475  free(__pyx_v_info->strides);
21476 
21477  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":293
21478  * if PyArray_HASFIELDS(self):
21479  * stdlib.free(info.format)
21480  * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
21481  * stdlib.free(info.strides)
21482  * # info.shape was stored after info.strides in the same block
21483  */
21484  }
21485 
21486  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":290
21487  * f[0] = c'\0' # Terminate format string
21488  *
21489  * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
21490  * if PyArray_HASFIELDS(self):
21491  * stdlib.free(info.format)
21492  */
21493 
21494  /* function exit code */
21495  __Pyx_RefNannyFinishContext();
21496 }
21497 
21498 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":770
21499  * ctypedef npy_cdouble complex_t
21500  *
21501  * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
21502  * return PyArray_MultiIterNew(1, <void*>a)
21503  *
21504  */
21505 
21506 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
21507  PyObject *__pyx_r = NULL;
21508  __Pyx_RefNannyDeclarations
21509  PyObject *__pyx_t_1 = NULL;
21510  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
21511 
21512  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":771
21513  *
21514  * cdef inline object PyArray_MultiIterNew1(a):
21515  * return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
21516  *
21517  * cdef inline object PyArray_MultiIterNew2(a, b):
21518  */
21519  __Pyx_XDECREF(__pyx_r);
21520  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 771, __pyx_L1_error)
21521  __Pyx_GOTREF(__pyx_t_1);
21522  __pyx_r = __pyx_t_1;
21523  __pyx_t_1 = 0;
21524  goto __pyx_L0;
21525 
21526  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":770
21527  * ctypedef npy_cdouble complex_t
21528  *
21529  * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
21530  * return PyArray_MultiIterNew(1, <void*>a)
21531  *
21532  */
21533 
21534  /* function exit code */
21535  __pyx_L1_error:;
21536  __Pyx_XDECREF(__pyx_t_1);
21537  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
21538  __pyx_r = 0;
21539  __pyx_L0:;
21540  __Pyx_XGIVEREF(__pyx_r);
21541  __Pyx_RefNannyFinishContext();
21542  return __pyx_r;
21543 }
21544 
21545 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":773
21546  * return PyArray_MultiIterNew(1, <void*>a)
21547  *
21548  * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
21549  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
21550  *
21551  */
21552 
21553 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
21554  PyObject *__pyx_r = NULL;
21555  __Pyx_RefNannyDeclarations
21556  PyObject *__pyx_t_1 = NULL;
21557  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
21558 
21559  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":774
21560  *
21561  * cdef inline object PyArray_MultiIterNew2(a, b):
21562  * return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
21563  *
21564  * cdef inline object PyArray_MultiIterNew3(a, b, c):
21565  */
21566  __Pyx_XDECREF(__pyx_r);
21567  __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 774, __pyx_L1_error)
21568  __Pyx_GOTREF(__pyx_t_1);
21569  __pyx_r = __pyx_t_1;
21570  __pyx_t_1 = 0;
21571  goto __pyx_L0;
21572 
21573  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":773
21574  * return PyArray_MultiIterNew(1, <void*>a)
21575  *
21576  * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
21577  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
21578  *
21579  */
21580 
21581  /* function exit code */
21582  __pyx_L1_error:;
21583  __Pyx_XDECREF(__pyx_t_1);
21584  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
21585  __pyx_r = 0;
21586  __pyx_L0:;
21587  __Pyx_XGIVEREF(__pyx_r);
21588  __Pyx_RefNannyFinishContext();
21589  return __pyx_r;
21590 }
21591 
21592 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":776
21593  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
21594  *
21595  * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
21596  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
21597  *
21598  */
21599 
21600 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
21601  PyObject *__pyx_r = NULL;
21602  __Pyx_RefNannyDeclarations
21603  PyObject *__pyx_t_1 = NULL;
21604  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
21605 
21606  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":777
21607  *
21608  * cdef inline object PyArray_MultiIterNew3(a, b, c):
21609  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
21610  *
21611  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
21612  */
21613  __Pyx_XDECREF(__pyx_r);
21614  __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 777, __pyx_L1_error)
21615  __Pyx_GOTREF(__pyx_t_1);
21616  __pyx_r = __pyx_t_1;
21617  __pyx_t_1 = 0;
21618  goto __pyx_L0;
21619 
21620  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":776
21621  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
21622  *
21623  * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
21624  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
21625  *
21626  */
21627 
21628  /* function exit code */
21629  __pyx_L1_error:;
21630  __Pyx_XDECREF(__pyx_t_1);
21631  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
21632  __pyx_r = 0;
21633  __pyx_L0:;
21634  __Pyx_XGIVEREF(__pyx_r);
21635  __Pyx_RefNannyFinishContext();
21636  return __pyx_r;
21637 }
21638 
21639 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":779
21640  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
21641  *
21642  * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
21643  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
21644  *
21645  */
21646 
21647 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
21648  PyObject *__pyx_r = NULL;
21649  __Pyx_RefNannyDeclarations
21650  PyObject *__pyx_t_1 = NULL;
21651  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
21652 
21653  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":780
21654  *
21655  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
21656  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
21657  *
21658  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
21659  */
21660  __Pyx_XDECREF(__pyx_r);
21661  __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 780, __pyx_L1_error)
21662  __Pyx_GOTREF(__pyx_t_1);
21663  __pyx_r = __pyx_t_1;
21664  __pyx_t_1 = 0;
21665  goto __pyx_L0;
21666 
21667  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":779
21668  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
21669  *
21670  * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
21671  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
21672  *
21673  */
21674 
21675  /* function exit code */
21676  __pyx_L1_error:;
21677  __Pyx_XDECREF(__pyx_t_1);
21678  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
21679  __pyx_r = 0;
21680  __pyx_L0:;
21681  __Pyx_XGIVEREF(__pyx_r);
21682  __Pyx_RefNannyFinishContext();
21683  return __pyx_r;
21684 }
21685 
21686 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":782
21687  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
21688  *
21689  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
21690  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
21691  *
21692  */
21693 
21694 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
21695  PyObject *__pyx_r = NULL;
21696  __Pyx_RefNannyDeclarations
21697  PyObject *__pyx_t_1 = NULL;
21698  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
21699 
21700  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":783
21701  *
21702  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
21703  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
21704  *
21705  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
21706  */
21707  __Pyx_XDECREF(__pyx_r);
21708  __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 783, __pyx_L1_error)
21709  __Pyx_GOTREF(__pyx_t_1);
21710  __pyx_r = __pyx_t_1;
21711  __pyx_t_1 = 0;
21712  goto __pyx_L0;
21713 
21714  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":782
21715  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
21716  *
21717  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
21718  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
21719  *
21720  */
21721 
21722  /* function exit code */
21723  __pyx_L1_error:;
21724  __Pyx_XDECREF(__pyx_t_1);
21725  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
21726  __pyx_r = 0;
21727  __pyx_L0:;
21728  __Pyx_XGIVEREF(__pyx_r);
21729  __Pyx_RefNannyFinishContext();
21730  return __pyx_r;
21731 }
21732 
21733 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":785
21734  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
21735  *
21736  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
21737  * # Recursive utility function used in __getbuffer__ to get format
21738  * # string. The new location in the format string is returned.
21739  */
21740 
21741 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
21742  PyArray_Descr *__pyx_v_child = 0;
21743  int __pyx_v_endian_detector;
21744  int __pyx_v_little_endian;
21745  PyObject *__pyx_v_fields = 0;
21746  PyObject *__pyx_v_childname = NULL;
21747  PyObject *__pyx_v_new_offset = NULL;
21748  PyObject *__pyx_v_t = NULL;
21749  char *__pyx_r;
21750  __Pyx_RefNannyDeclarations
21751  PyObject *__pyx_t_1 = NULL;
21752  Py_ssize_t __pyx_t_2;
21753  PyObject *__pyx_t_3 = NULL;
21754  PyObject *__pyx_t_4 = NULL;
21755  int __pyx_t_5;
21756  int __pyx_t_6;
21757  int __pyx_t_7;
21758  long __pyx_t_8;
21759  char *__pyx_t_9;
21760  __Pyx_RefNannySetupContext("_util_dtypestring", 0);
21761 
21762  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":790
21763  *
21764  * cdef dtype child
21765  * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
21766  * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
21767  * cdef tuple fields
21768  */
21769  __pyx_v_endian_detector = 1;
21770 
21771  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":791
21772  * cdef dtype child
21773  * cdef int endian_detector = 1
21774  * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
21775  * cdef tuple fields
21776  *
21777  */
21778  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
21779 
21780  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":794
21781  * cdef tuple fields
21782  *
21783  * for childname in descr.names: # <<<<<<<<<<<<<<
21784  * fields = descr.fields[childname]
21785  * child, new_offset = fields
21786  */
21787  if (unlikely(__pyx_v_descr->names == Py_None)) {
21788  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
21789  __PYX_ERR(1, 794, __pyx_L1_error)
21790  }
21791  __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
21792  for (;;) {
21793  if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
21794  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
21795  __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 794, __pyx_L1_error)
21796  #else
21797  __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 794, __pyx_L1_error)
21798  __Pyx_GOTREF(__pyx_t_3);
21799  #endif
21800  __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
21801  __pyx_t_3 = 0;
21802 
21803  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":795
21804  *
21805  * for childname in descr.names:
21806  * fields = descr.fields[childname] # <<<<<<<<<<<<<<
21807  * child, new_offset = fields
21808  *
21809  */
21810  if (unlikely(__pyx_v_descr->fields == Py_None)) {
21811  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
21812  __PYX_ERR(1, 795, __pyx_L1_error)
21813  }
21814  __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 795, __pyx_L1_error)
21815  __Pyx_GOTREF(__pyx_t_3);
21816  if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 795, __pyx_L1_error)
21817  __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
21818  __pyx_t_3 = 0;
21819 
21820  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":796
21821  * for childname in descr.names:
21822  * fields = descr.fields[childname]
21823  * child, new_offset = fields # <<<<<<<<<<<<<<
21824  *
21825  * if (end - f) - <int>(new_offset - offset[0]) < 15:
21826  */
21827  if (likely(__pyx_v_fields != Py_None)) {
21828  PyObject* sequence = __pyx_v_fields;
21829  #if !CYTHON_COMPILING_IN_PYPY
21830  Py_ssize_t size = Py_SIZE(sequence);
21831  #else
21832  Py_ssize_t size = PySequence_Size(sequence);
21833  #endif
21834  if (unlikely(size != 2)) {
21835  if (size > 2) __Pyx_RaiseTooManyValuesError(2);
21836  else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
21837  __PYX_ERR(1, 796, __pyx_L1_error)
21838  }
21839  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
21840  __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
21841  __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
21842  __Pyx_INCREF(__pyx_t_3);
21843  __Pyx_INCREF(__pyx_t_4);
21844  #else
21845  __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 796, __pyx_L1_error)
21846  __Pyx_GOTREF(__pyx_t_3);
21847  __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 796, __pyx_L1_error)
21848  __Pyx_GOTREF(__pyx_t_4);
21849  #endif
21850  } else {
21851  __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 796, __pyx_L1_error)
21852  }
21853  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 796, __pyx_L1_error)
21854  __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
21855  __pyx_t_3 = 0;
21856  __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
21857  __pyx_t_4 = 0;
21858 
21859  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":798
21860  * child, new_offset = fields
21861  *
21862  * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
21863  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
21864  *
21865  */
21866  __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 798, __pyx_L1_error)
21867  __Pyx_GOTREF(__pyx_t_4);
21868  __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 798, __pyx_L1_error)
21869  __Pyx_GOTREF(__pyx_t_3);
21870  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21871  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 798, __pyx_L1_error)
21872  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21873  __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
21874  if (__pyx_t_6) {
21875 
21876  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":799
21877  *
21878  * if (end - f) - <int>(new_offset - offset[0]) < 15:
21879  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
21880  *
21881  * if ((child.byteorder == c'>' and little_endian) or
21882  */
21883  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 799, __pyx_L1_error)
21884  __Pyx_GOTREF(__pyx_t_3);
21885  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
21886  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21887  __PYX_ERR(1, 799, __pyx_L1_error)
21888 
21889  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":798
21890  * child, new_offset = fields
21891  *
21892  * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
21893  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
21894  *
21895  */
21896  }
21897 
21898  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":801
21899  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
21900  *
21901  * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
21902  * (child.byteorder == c'<' and not little_endian)):
21903  * raise ValueError(u"Non-native byte order not supported")
21904  */
21905  __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
21906  if (!__pyx_t_7) {
21907  goto __pyx_L8_next_or;
21908  } else {
21909  }
21910  __pyx_t_7 = (__pyx_v_little_endian != 0);
21911  if (!__pyx_t_7) {
21912  } else {
21913  __pyx_t_6 = __pyx_t_7;
21914  goto __pyx_L7_bool_binop_done;
21915  }
21916  __pyx_L8_next_or:;
21917 
21918  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":802
21919  *
21920  * if ((child.byteorder == c'>' and little_endian) or
21921  * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
21922  * raise ValueError(u"Non-native byte order not supported")
21923  * # One could encode it in the format string and have Cython
21924  */
21925  __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
21926  if (__pyx_t_7) {
21927  } else {
21928  __pyx_t_6 = __pyx_t_7;
21929  goto __pyx_L7_bool_binop_done;
21930  }
21931  __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
21932  __pyx_t_6 = __pyx_t_7;
21933  __pyx_L7_bool_binop_done:;
21934 
21935  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":801
21936  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
21937  *
21938  * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
21939  * (child.byteorder == c'<' and not little_endian)):
21940  * raise ValueError(u"Non-native byte order not supported")
21941  */
21942  if (__pyx_t_6) {
21943 
21944  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":803
21945  * if ((child.byteorder == c'>' and little_endian) or
21946  * (child.byteorder == c'<' and not little_endian)):
21947  * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
21948  * # One could encode it in the format string and have Cython
21949  * # complain instead, BUT: < and > in format strings also imply
21950  */
21951  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 803, __pyx_L1_error)
21952  __Pyx_GOTREF(__pyx_t_3);
21953  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
21954  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21955  __PYX_ERR(1, 803, __pyx_L1_error)
21956 
21957  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":801
21958  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
21959  *
21960  * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
21961  * (child.byteorder == c'<' and not little_endian)):
21962  * raise ValueError(u"Non-native byte order not supported")
21963  */
21964  }
21965 
21966  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":813
21967  *
21968  * # Output padding bytes
21969  * while offset[0] < new_offset: # <<<<<<<<<<<<<<
21970  * f[0] = 120 # "x"; pad byte
21971  * f += 1
21972  */
21973  while (1) {
21974  __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 813, __pyx_L1_error)
21975  __Pyx_GOTREF(__pyx_t_3);
21976  __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 813, __pyx_L1_error)
21977  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21978  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 813, __pyx_L1_error)
21979  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21980  if (!__pyx_t_6) break;
21981 
21982  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":814
21983  * # Output padding bytes
21984  * while offset[0] < new_offset:
21985  * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<<
21986  * f += 1
21987  * offset[0] += 1
21988  */
21989  (__pyx_v_f[0]) = 0x78;
21990 
21991  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":815
21992  * while offset[0] < new_offset:
21993  * f[0] = 120 # "x"; pad byte
21994  * f += 1 # <<<<<<<<<<<<<<
21995  * offset[0] += 1
21996  *
21997  */
21998  __pyx_v_f = (__pyx_v_f + 1);
21999 
22000  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":816
22001  * f[0] = 120 # "x"; pad byte
22002  * f += 1
22003  * offset[0] += 1 # <<<<<<<<<<<<<<
22004  *
22005  * offset[0] += child.itemsize
22006  */
22007  __pyx_t_8 = 0;
22008  (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
22009  }
22010 
22011  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":818
22012  * offset[0] += 1
22013  *
22014  * offset[0] += child.itemsize # <<<<<<<<<<<<<<
22015  *
22016  * if not PyDataType_HASFIELDS(child):
22017  */
22018  __pyx_t_8 = 0;
22019  (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
22020 
22021  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":820
22022  * offset[0] += child.itemsize
22023  *
22024  * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
22025  * t = child.type_num
22026  * if end - f < 5:
22027  */
22028  __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
22029  if (__pyx_t_6) {
22030 
22031  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":821
22032  *
22033  * if not PyDataType_HASFIELDS(child):
22034  * t = child.type_num # <<<<<<<<<<<<<<
22035  * if end - f < 5:
22036  * raise RuntimeError(u"Format string allocated too short.")
22037  */
22038  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 821, __pyx_L1_error)
22039  __Pyx_GOTREF(__pyx_t_4);
22040  __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
22041  __pyx_t_4 = 0;
22042 
22043  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":822
22044  * if not PyDataType_HASFIELDS(child):
22045  * t = child.type_num
22046  * if end - f < 5: # <<<<<<<<<<<<<<
22047  * raise RuntimeError(u"Format string allocated too short.")
22048  *
22049  */
22050  __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
22051  if (__pyx_t_6) {
22052 
22053  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":823
22054  * t = child.type_num
22055  * if end - f < 5:
22056  * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
22057  *
22058  * # Until ticket #99 is fixed, use integers to avoid warnings
22059  */
22060  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 823, __pyx_L1_error)
22061  __Pyx_GOTREF(__pyx_t_4);
22062  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
22063  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22064  __PYX_ERR(1, 823, __pyx_L1_error)
22065 
22066  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":822
22067  * if not PyDataType_HASFIELDS(child):
22068  * t = child.type_num
22069  * if end - f < 5: # <<<<<<<<<<<<<<
22070  * raise RuntimeError(u"Format string allocated too short.")
22071  *
22072  */
22073  }
22074 
22075  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":826
22076  *
22077  * # Until ticket #99 is fixed, use integers to avoid warnings
22078  * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<<
22079  * elif t == NPY_UBYTE: f[0] = 66 #"B"
22080  * elif t == NPY_SHORT: f[0] = 104 #"h"
22081  */
22082  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 826, __pyx_L1_error)
22083  __Pyx_GOTREF(__pyx_t_4);
22084  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 826, __pyx_L1_error)
22085  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22086  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 826, __pyx_L1_error)
22087  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22088  if (__pyx_t_6) {
22089  (__pyx_v_f[0]) = 98;
22090  goto __pyx_L15;
22091  }
22092 
22093  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":827
22094  * # Until ticket #99 is fixed, use integers to avoid warnings
22095  * if t == NPY_BYTE: f[0] = 98 #"b"
22096  * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<<
22097  * elif t == NPY_SHORT: f[0] = 104 #"h"
22098  * elif t == NPY_USHORT: f[0] = 72 #"H"
22099  */
22100  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 827, __pyx_L1_error)
22101  __Pyx_GOTREF(__pyx_t_3);
22102  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 827, __pyx_L1_error)
22103  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22104  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 827, __pyx_L1_error)
22105  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22106  if (__pyx_t_6) {
22107  (__pyx_v_f[0]) = 66;
22108  goto __pyx_L15;
22109  }
22110 
22111  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":828
22112  * if t == NPY_BYTE: f[0] = 98 #"b"
22113  * elif t == NPY_UBYTE: f[0] = 66 #"B"
22114  * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<<
22115  * elif t == NPY_USHORT: f[0] = 72 #"H"
22116  * elif t == NPY_INT: f[0] = 105 #"i"
22117  */
22118  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 828, __pyx_L1_error)
22119  __Pyx_GOTREF(__pyx_t_4);
22120  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 828, __pyx_L1_error)
22121  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22122  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 828, __pyx_L1_error)
22123  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22124  if (__pyx_t_6) {
22125  (__pyx_v_f[0]) = 0x68;
22126  goto __pyx_L15;
22127  }
22128 
22129  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":829
22130  * elif t == NPY_UBYTE: f[0] = 66 #"B"
22131  * elif t == NPY_SHORT: f[0] = 104 #"h"
22132  * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<<
22133  * elif t == NPY_INT: f[0] = 105 #"i"
22134  * elif t == NPY_UINT: f[0] = 73 #"I"
22135  */
22136  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 829, __pyx_L1_error)
22137  __Pyx_GOTREF(__pyx_t_3);
22138  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 829, __pyx_L1_error)
22139  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22140  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 829, __pyx_L1_error)
22141  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22142  if (__pyx_t_6) {
22143  (__pyx_v_f[0]) = 72;
22144  goto __pyx_L15;
22145  }
22146 
22147  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":830
22148  * elif t == NPY_SHORT: f[0] = 104 #"h"
22149  * elif t == NPY_USHORT: f[0] = 72 #"H"
22150  * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<<
22151  * elif t == NPY_UINT: f[0] = 73 #"I"
22152  * elif t == NPY_LONG: f[0] = 108 #"l"
22153  */
22154  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 830, __pyx_L1_error)
22155  __Pyx_GOTREF(__pyx_t_4);
22156  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 830, __pyx_L1_error)
22157  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22158  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 830, __pyx_L1_error)
22159  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22160  if (__pyx_t_6) {
22161  (__pyx_v_f[0]) = 0x69;
22162  goto __pyx_L15;
22163  }
22164 
22165  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":831
22166  * elif t == NPY_USHORT: f[0] = 72 #"H"
22167  * elif t == NPY_INT: f[0] = 105 #"i"
22168  * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<<
22169  * elif t == NPY_LONG: f[0] = 108 #"l"
22170  * elif t == NPY_ULONG: f[0] = 76 #"L"
22171  */
22172  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 831, __pyx_L1_error)
22173  __Pyx_GOTREF(__pyx_t_3);
22174  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 831, __pyx_L1_error)
22175  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22176  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 831, __pyx_L1_error)
22177  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22178  if (__pyx_t_6) {
22179  (__pyx_v_f[0]) = 73;
22180  goto __pyx_L15;
22181  }
22182 
22183  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":832
22184  * elif t == NPY_INT: f[0] = 105 #"i"
22185  * elif t == NPY_UINT: f[0] = 73 #"I"
22186  * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<<
22187  * elif t == NPY_ULONG: f[0] = 76 #"L"
22188  * elif t == NPY_LONGLONG: f[0] = 113 #"q"
22189  */
22190  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 832, __pyx_L1_error)
22191  __Pyx_GOTREF(__pyx_t_4);
22192  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 832, __pyx_L1_error)
22193  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22194  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 832, __pyx_L1_error)
22195  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22196  if (__pyx_t_6) {
22197  (__pyx_v_f[0]) = 0x6C;
22198  goto __pyx_L15;
22199  }
22200 
22201  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":833
22202  * elif t == NPY_UINT: f[0] = 73 #"I"
22203  * elif t == NPY_LONG: f[0] = 108 #"l"
22204  * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<<
22205  * elif t == NPY_LONGLONG: f[0] = 113 #"q"
22206  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
22207  */
22208  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 833, __pyx_L1_error)
22209  __Pyx_GOTREF(__pyx_t_3);
22210  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 833, __pyx_L1_error)
22211  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22212  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 833, __pyx_L1_error)
22213  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22214  if (__pyx_t_6) {
22215  (__pyx_v_f[0]) = 76;
22216  goto __pyx_L15;
22217  }
22218 
22219  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":834
22220  * elif t == NPY_LONG: f[0] = 108 #"l"
22221  * elif t == NPY_ULONG: f[0] = 76 #"L"
22222  * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<<
22223  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
22224  * elif t == NPY_FLOAT: f[0] = 102 #"f"
22225  */
22226  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 834, __pyx_L1_error)
22227  __Pyx_GOTREF(__pyx_t_4);
22228  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 834, __pyx_L1_error)
22229  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22230  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 834, __pyx_L1_error)
22231  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22232  if (__pyx_t_6) {
22233  (__pyx_v_f[0]) = 0x71;
22234  goto __pyx_L15;
22235  }
22236 
22237  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":835
22238  * elif t == NPY_ULONG: f[0] = 76 #"L"
22239  * elif t == NPY_LONGLONG: f[0] = 113 #"q"
22240  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<<
22241  * elif t == NPY_FLOAT: f[0] = 102 #"f"
22242  * elif t == NPY_DOUBLE: f[0] = 100 #"d"
22243  */
22244  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 835, __pyx_L1_error)
22245  __Pyx_GOTREF(__pyx_t_3);
22246  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 835, __pyx_L1_error)
22247  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22248  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 835, __pyx_L1_error)
22249  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22250  if (__pyx_t_6) {
22251  (__pyx_v_f[0]) = 81;
22252  goto __pyx_L15;
22253  }
22254 
22255  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":836
22256  * elif t == NPY_LONGLONG: f[0] = 113 #"q"
22257  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
22258  * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<<
22259  * elif t == NPY_DOUBLE: f[0] = 100 #"d"
22260  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
22261  */
22262  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 836, __pyx_L1_error)
22263  __Pyx_GOTREF(__pyx_t_4);
22264  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 836, __pyx_L1_error)
22265  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22266  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 836, __pyx_L1_error)
22267  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22268  if (__pyx_t_6) {
22269  (__pyx_v_f[0]) = 0x66;
22270  goto __pyx_L15;
22271  }
22272 
22273  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":837
22274  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
22275  * elif t == NPY_FLOAT: f[0] = 102 #"f"
22276  * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<<
22277  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
22278  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
22279  */
22280  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 837, __pyx_L1_error)
22281  __Pyx_GOTREF(__pyx_t_3);
22282  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 837, __pyx_L1_error)
22283  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22284  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 837, __pyx_L1_error)
22285  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22286  if (__pyx_t_6) {
22287  (__pyx_v_f[0]) = 0x64;
22288  goto __pyx_L15;
22289  }
22290 
22291  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":838
22292  * elif t == NPY_FLOAT: f[0] = 102 #"f"
22293  * elif t == NPY_DOUBLE: f[0] = 100 #"d"
22294  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<<
22295  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
22296  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
22297  */
22298  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 838, __pyx_L1_error)
22299  __Pyx_GOTREF(__pyx_t_4);
22300  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 838, __pyx_L1_error)
22301  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22302  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 838, __pyx_L1_error)
22303  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22304  if (__pyx_t_6) {
22305  (__pyx_v_f[0]) = 0x67;
22306  goto __pyx_L15;
22307  }
22308 
22309  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":839
22310  * elif t == NPY_DOUBLE: f[0] = 100 #"d"
22311  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
22312  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<<
22313  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
22314  * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
22315  */
22316  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 839, __pyx_L1_error)
22317  __Pyx_GOTREF(__pyx_t_3);
22318  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 839, __pyx_L1_error)
22319  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22320  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 839, __pyx_L1_error)
22321  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22322  if (__pyx_t_6) {
22323  (__pyx_v_f[0]) = 90;
22324  (__pyx_v_f[1]) = 0x66;
22325  __pyx_v_f = (__pyx_v_f + 1);
22326  goto __pyx_L15;
22327  }
22328 
22329  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":840
22330  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
22331  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
22332  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<<
22333  * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
22334  * elif t == NPY_OBJECT: f[0] = 79 #"O"
22335  */
22336  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 840, __pyx_L1_error)
22337  __Pyx_GOTREF(__pyx_t_4);
22338  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 840, __pyx_L1_error)
22339  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22340  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 840, __pyx_L1_error)
22341  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22342  if (__pyx_t_6) {
22343  (__pyx_v_f[0]) = 90;
22344  (__pyx_v_f[1]) = 0x64;
22345  __pyx_v_f = (__pyx_v_f + 1);
22346  goto __pyx_L15;
22347  }
22348 
22349  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":841
22350  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
22351  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
22352  * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<<
22353  * elif t == NPY_OBJECT: f[0] = 79 #"O"
22354  * else:
22355  */
22356  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 841, __pyx_L1_error)
22357  __Pyx_GOTREF(__pyx_t_3);
22358  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 841, __pyx_L1_error)
22359  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22360  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 841, __pyx_L1_error)
22361  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22362  if (__pyx_t_6) {
22363  (__pyx_v_f[0]) = 90;
22364  (__pyx_v_f[1]) = 0x67;
22365  __pyx_v_f = (__pyx_v_f + 1);
22366  goto __pyx_L15;
22367  }
22368 
22369  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":842
22370  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
22371  * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
22372  * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<<
22373  * else:
22374  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
22375  */
22376  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 842, __pyx_L1_error)
22377  __Pyx_GOTREF(__pyx_t_4);
22378  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 842, __pyx_L1_error)
22379  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22380  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 842, __pyx_L1_error)
22381  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22382  if (__pyx_t_6) {
22383  (__pyx_v_f[0]) = 79;
22384  goto __pyx_L15;
22385  }
22386 
22387  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":844
22388  * elif t == NPY_OBJECT: f[0] = 79 #"O"
22389  * else:
22390  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
22391  * f += 1
22392  * else:
22393  */
22394  /*else*/ {
22395  __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 844, __pyx_L1_error)
22396  __Pyx_GOTREF(__pyx_t_3);
22397  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 844, __pyx_L1_error)
22398  __Pyx_GOTREF(__pyx_t_4);
22399  __Pyx_GIVEREF(__pyx_t_3);
22400  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
22401  __pyx_t_3 = 0;
22402  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 844, __pyx_L1_error)
22403  __Pyx_GOTREF(__pyx_t_3);
22404  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22405  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
22406  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22407  __PYX_ERR(1, 844, __pyx_L1_error)
22408  }
22409  __pyx_L15:;
22410 
22411  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":845
22412  * else:
22413  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
22414  * f += 1 # <<<<<<<<<<<<<<
22415  * else:
22416  * # Cython ignores struct boundary information ("T{...}"),
22417  */
22418  __pyx_v_f = (__pyx_v_f + 1);
22419 
22420  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":820
22421  * offset[0] += child.itemsize
22422  *
22423  * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
22424  * t = child.type_num
22425  * if end - f < 5:
22426  */
22427  goto __pyx_L13;
22428  }
22429 
22430  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":849
22431  * # Cython ignores struct boundary information ("T{...}"),
22432  * # so don't output it
22433  * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<<
22434  * return f
22435  *
22436  */
22437  /*else*/ {
22438  __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == NULL)) __PYX_ERR(1, 849, __pyx_L1_error)
22439  __pyx_v_f = __pyx_t_9;
22440  }
22441  __pyx_L13:;
22442 
22443  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":794
22444  * cdef tuple fields
22445  *
22446  * for childname in descr.names: # <<<<<<<<<<<<<<
22447  * fields = descr.fields[childname]
22448  * child, new_offset = fields
22449  */
22450  }
22451  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22452 
22453  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":850
22454  * # so don't output it
22455  * f = _util_dtypestring(child, f, end, offset)
22456  * return f # <<<<<<<<<<<<<<
22457  *
22458  *
22459  */
22460  __pyx_r = __pyx_v_f;
22461  goto __pyx_L0;
22462 
22463  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":785
22464  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
22465  *
22466  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
22467  * # Recursive utility function used in __getbuffer__ to get format
22468  * # string. The new location in the format string is returned.
22469  */
22470 
22471  /* function exit code */
22472  __pyx_L1_error:;
22473  __Pyx_XDECREF(__pyx_t_1);
22474  __Pyx_XDECREF(__pyx_t_3);
22475  __Pyx_XDECREF(__pyx_t_4);
22476  __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
22477  __pyx_r = NULL;
22478  __pyx_L0:;
22479  __Pyx_XDECREF((PyObject *)__pyx_v_child);
22480  __Pyx_XDECREF(__pyx_v_fields);
22481  __Pyx_XDECREF(__pyx_v_childname);
22482  __Pyx_XDECREF(__pyx_v_new_offset);
22483  __Pyx_XDECREF(__pyx_v_t);
22484  __Pyx_RefNannyFinishContext();
22485  return __pyx_r;
22486 }
22487 
22488 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":966
22489  *
22490  *
22491  * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
22492  * cdef PyObject* baseptr
22493  * if base is None:
22494  */
22495 
22496 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
22497  PyObject *__pyx_v_baseptr;
22498  __Pyx_RefNannyDeclarations
22499  int __pyx_t_1;
22500  int __pyx_t_2;
22501  __Pyx_RefNannySetupContext("set_array_base", 0);
22502 
22503  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":968
22504  * cdef inline void set_array_base(ndarray arr, object base):
22505  * cdef PyObject* baseptr
22506  * if base is None: # <<<<<<<<<<<<<<
22507  * baseptr = NULL
22508  * else:
22509  */
22510  __pyx_t_1 = (__pyx_v_base == Py_None);
22511  __pyx_t_2 = (__pyx_t_1 != 0);
22512  if (__pyx_t_2) {
22513 
22514  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":969
22515  * cdef PyObject* baseptr
22516  * if base is None:
22517  * baseptr = NULL # <<<<<<<<<<<<<<
22518  * else:
22519  * Py_INCREF(base) # important to do this before decref below!
22520  */
22521  __pyx_v_baseptr = NULL;
22522 
22523  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":968
22524  * cdef inline void set_array_base(ndarray arr, object base):
22525  * cdef PyObject* baseptr
22526  * if base is None: # <<<<<<<<<<<<<<
22527  * baseptr = NULL
22528  * else:
22529  */
22530  goto __pyx_L3;
22531  }
22532 
22533  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":971
22534  * baseptr = NULL
22535  * else:
22536  * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<<
22537  * baseptr = <PyObject*>base
22538  * Py_XDECREF(arr.base)
22539  */
22540  /*else*/ {
22541  Py_INCREF(__pyx_v_base);
22542 
22543  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":972
22544  * else:
22545  * Py_INCREF(base) # important to do this before decref below!
22546  * baseptr = <PyObject*>base # <<<<<<<<<<<<<<
22547  * Py_XDECREF(arr.base)
22548  * arr.base = baseptr
22549  */
22550  __pyx_v_baseptr = ((PyObject *)__pyx_v_base);
22551  }
22552  __pyx_L3:;
22553 
22554  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":973
22555  * Py_INCREF(base) # important to do this before decref below!
22556  * baseptr = <PyObject*>base
22557  * Py_XDECREF(arr.base) # <<<<<<<<<<<<<<
22558  * arr.base = baseptr
22559  *
22560  */
22561  Py_XDECREF(__pyx_v_arr->base);
22562 
22563  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":974
22564  * baseptr = <PyObject*>base
22565  * Py_XDECREF(arr.base)
22566  * arr.base = baseptr # <<<<<<<<<<<<<<
22567  *
22568  * cdef inline object get_array_base(ndarray arr):
22569  */
22570  __pyx_v_arr->base = __pyx_v_baseptr;
22571 
22572  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":966
22573  *
22574  *
22575  * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
22576  * cdef PyObject* baseptr
22577  * if base is None:
22578  */
22579 
22580  /* function exit code */
22581  __Pyx_RefNannyFinishContext();
22582 }
22583 
22584 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":976
22585  * arr.base = baseptr
22586  *
22587  * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
22588  * if arr.base is NULL:
22589  * return None
22590  */
22591 
22592 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
22593  PyObject *__pyx_r = NULL;
22594  __Pyx_RefNannyDeclarations
22595  int __pyx_t_1;
22596  __Pyx_RefNannySetupContext("get_array_base", 0);
22597 
22598  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":977
22599  *
22600  * cdef inline object get_array_base(ndarray arr):
22601  * if arr.base is NULL: # <<<<<<<<<<<<<<
22602  * return None
22603  * else:
22604  */
22605  __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
22606  if (__pyx_t_1) {
22607 
22608  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":978
22609  * cdef inline object get_array_base(ndarray arr):
22610  * if arr.base is NULL:
22611  * return None # <<<<<<<<<<<<<<
22612  * else:
22613  * return <object>arr.base
22614  */
22615  __Pyx_XDECREF(__pyx_r);
22616  __Pyx_INCREF(Py_None);
22617  __pyx_r = Py_None;
22618  goto __pyx_L0;
22619 
22620  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":977
22621  *
22622  * cdef inline object get_array_base(ndarray arr):
22623  * if arr.base is NULL: # <<<<<<<<<<<<<<
22624  * return None
22625  * else:
22626  */
22627  }
22628 
22629  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":980
22630  * return None
22631  * else:
22632  * return <object>arr.base # <<<<<<<<<<<<<<
22633  *
22634  *
22635  */
22636  /*else*/ {
22637  __Pyx_XDECREF(__pyx_r);
22638  __Pyx_INCREF(((PyObject *)__pyx_v_arr->base));
22639  __pyx_r = ((PyObject *)__pyx_v_arr->base);
22640  goto __pyx_L0;
22641  }
22642 
22643  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":976
22644  * arr.base = baseptr
22645  *
22646  * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
22647  * if arr.base is NULL:
22648  * return None
22649  */
22650 
22651  /* function exit code */
22652  __pyx_L0:;
22653  __Pyx_XGIVEREF(__pyx_r);
22654  __Pyx_RefNannyFinishContext();
22655  return __pyx_r;
22656 }
22657 
22658 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":985
22659  * # Versions of the import_* functions which are more suitable for
22660  * # Cython code.
22661  * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
22662  * try:
22663  * _import_array()
22664  */
22665 
22666 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
22667  int __pyx_r;
22668  __Pyx_RefNannyDeclarations
22669  PyObject *__pyx_t_1 = NULL;
22670  PyObject *__pyx_t_2 = NULL;
22671  PyObject *__pyx_t_3 = NULL;
22672  int __pyx_t_4;
22673  PyObject *__pyx_t_5 = NULL;
22674  PyObject *__pyx_t_6 = NULL;
22675  PyObject *__pyx_t_7 = NULL;
22676  PyObject *__pyx_t_8 = NULL;
22677  __Pyx_RefNannySetupContext("import_array", 0);
22678 
22679  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":986
22680  * # Cython code.
22681  * cdef inline int import_array() except -1:
22682  * try: # <<<<<<<<<<<<<<
22683  * _import_array()
22684  * except Exception:
22685  */
22686  {
22687  __Pyx_PyThreadState_declare
22688  __Pyx_PyThreadState_assign
22689  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
22690  __Pyx_XGOTREF(__pyx_t_1);
22691  __Pyx_XGOTREF(__pyx_t_2);
22692  __Pyx_XGOTREF(__pyx_t_3);
22693  /*try:*/ {
22694 
22695  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":987
22696  * cdef inline int import_array() except -1:
22697  * try:
22698  * _import_array() # <<<<<<<<<<<<<<
22699  * except Exception:
22700  * raise ImportError("numpy.core.multiarray failed to import")
22701  */
22702  __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(1, 987, __pyx_L3_error)
22703 
22704  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":986
22705  * # Cython code.
22706  * cdef inline int import_array() except -1:
22707  * try: # <<<<<<<<<<<<<<
22708  * _import_array()
22709  * except Exception:
22710  */
22711  }
22712  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
22713  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
22714  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
22715  goto __pyx_L10_try_end;
22716  __pyx_L3_error:;
22717  __Pyx_PyThreadState_assign
22718 
22719  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":988
22720  * try:
22721  * _import_array()
22722  * except Exception: # <<<<<<<<<<<<<<
22723  * raise ImportError("numpy.core.multiarray failed to import")
22724  *
22725  */
22726  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
22727  if (__pyx_t_4) {
22728  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
22729  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 988, __pyx_L5_except_error)
22730  __Pyx_GOTREF(__pyx_t_5);
22731  __Pyx_GOTREF(__pyx_t_6);
22732  __Pyx_GOTREF(__pyx_t_7);
22733 
22734  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":989
22735  * _import_array()
22736  * except Exception:
22737  * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
22738  *
22739  * cdef inline int import_umath() except -1:
22740  */
22741  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 989, __pyx_L5_except_error)
22742  __Pyx_GOTREF(__pyx_t_8);
22743  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
22744  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
22745  __PYX_ERR(1, 989, __pyx_L5_except_error)
22746  }
22747  goto __pyx_L5_except_error;
22748  __pyx_L5_except_error:;
22749 
22750  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":986
22751  * # Cython code.
22752  * cdef inline int import_array() except -1:
22753  * try: # <<<<<<<<<<<<<<
22754  * _import_array()
22755  * except Exception:
22756  */
22757  __Pyx_PyThreadState_assign
22758  __Pyx_XGIVEREF(__pyx_t_1);
22759  __Pyx_XGIVEREF(__pyx_t_2);
22760  __Pyx_XGIVEREF(__pyx_t_3);
22761  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
22762  goto __pyx_L1_error;
22763  __pyx_L10_try_end:;
22764  }
22765 
22766  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":985
22767  * # Versions of the import_* functions which are more suitable for
22768  * # Cython code.
22769  * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
22770  * try:
22771  * _import_array()
22772  */
22773 
22774  /* function exit code */
22775  __pyx_r = 0;
22776  goto __pyx_L0;
22777  __pyx_L1_error:;
22778  __Pyx_XDECREF(__pyx_t_5);
22779  __Pyx_XDECREF(__pyx_t_6);
22780  __Pyx_XDECREF(__pyx_t_7);
22781  __Pyx_XDECREF(__pyx_t_8);
22782  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
22783  __pyx_r = -1;
22784  __pyx_L0:;
22785  __Pyx_RefNannyFinishContext();
22786  return __pyx_r;
22787 }
22788 
22789 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":991
22790  * raise ImportError("numpy.core.multiarray failed to import")
22791  *
22792  * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
22793  * try:
22794  * _import_umath()
22795  */
22796 
22797 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
22798  int __pyx_r;
22799  __Pyx_RefNannyDeclarations
22800  PyObject *__pyx_t_1 = NULL;
22801  PyObject *__pyx_t_2 = NULL;
22802  PyObject *__pyx_t_3 = NULL;
22803  int __pyx_t_4;
22804  PyObject *__pyx_t_5 = NULL;
22805  PyObject *__pyx_t_6 = NULL;
22806  PyObject *__pyx_t_7 = NULL;
22807  PyObject *__pyx_t_8 = NULL;
22808  __Pyx_RefNannySetupContext("import_umath", 0);
22809 
22810  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":992
22811  *
22812  * cdef inline int import_umath() except -1:
22813  * try: # <<<<<<<<<<<<<<
22814  * _import_umath()
22815  * except Exception:
22816  */
22817  {
22818  __Pyx_PyThreadState_declare
22819  __Pyx_PyThreadState_assign
22820  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
22821  __Pyx_XGOTREF(__pyx_t_1);
22822  __Pyx_XGOTREF(__pyx_t_2);
22823  __Pyx_XGOTREF(__pyx_t_3);
22824  /*try:*/ {
22825 
22826  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":993
22827  * cdef inline int import_umath() except -1:
22828  * try:
22829  * _import_umath() # <<<<<<<<<<<<<<
22830  * except Exception:
22831  * raise ImportError("numpy.core.umath failed to import")
22832  */
22833  __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(1, 993, __pyx_L3_error)
22834 
22835  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":992
22836  *
22837  * cdef inline int import_umath() except -1:
22838  * try: # <<<<<<<<<<<<<<
22839  * _import_umath()
22840  * except Exception:
22841  */
22842  }
22843  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
22844  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
22845  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
22846  goto __pyx_L10_try_end;
22847  __pyx_L3_error:;
22848  __Pyx_PyThreadState_assign
22849 
22850  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":994
22851  * try:
22852  * _import_umath()
22853  * except Exception: # <<<<<<<<<<<<<<
22854  * raise ImportError("numpy.core.umath failed to import")
22855  *
22856  */
22857  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
22858  if (__pyx_t_4) {
22859  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
22860  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 994, __pyx_L5_except_error)
22861  __Pyx_GOTREF(__pyx_t_5);
22862  __Pyx_GOTREF(__pyx_t_6);
22863  __Pyx_GOTREF(__pyx_t_7);
22864 
22865  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":995
22866  * _import_umath()
22867  * except Exception:
22868  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
22869  *
22870  * cdef inline int import_ufunc() except -1:
22871  */
22872  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 995, __pyx_L5_except_error)
22873  __Pyx_GOTREF(__pyx_t_8);
22874  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
22875  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
22876  __PYX_ERR(1, 995, __pyx_L5_except_error)
22877  }
22878  goto __pyx_L5_except_error;
22879  __pyx_L5_except_error:;
22880 
22881  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":992
22882  *
22883  * cdef inline int import_umath() except -1:
22884  * try: # <<<<<<<<<<<<<<
22885  * _import_umath()
22886  * except Exception:
22887  */
22888  __Pyx_PyThreadState_assign
22889  __Pyx_XGIVEREF(__pyx_t_1);
22890  __Pyx_XGIVEREF(__pyx_t_2);
22891  __Pyx_XGIVEREF(__pyx_t_3);
22892  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
22893  goto __pyx_L1_error;
22894  __pyx_L10_try_end:;
22895  }
22896 
22897  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":991
22898  * raise ImportError("numpy.core.multiarray failed to import")
22899  *
22900  * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
22901  * try:
22902  * _import_umath()
22903  */
22904 
22905  /* function exit code */
22906  __pyx_r = 0;
22907  goto __pyx_L0;
22908  __pyx_L1_error:;
22909  __Pyx_XDECREF(__pyx_t_5);
22910  __Pyx_XDECREF(__pyx_t_6);
22911  __Pyx_XDECREF(__pyx_t_7);
22912  __Pyx_XDECREF(__pyx_t_8);
22913  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
22914  __pyx_r = -1;
22915  __pyx_L0:;
22916  __Pyx_RefNannyFinishContext();
22917  return __pyx_r;
22918 }
22919 
22920 /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":997
22921  * raise ImportError("numpy.core.umath failed to import")
22922  *
22923  * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
22924  * try:
22925  * _import_umath()
22926  */
22927 
22928 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
22929  int __pyx_r;
22930  __Pyx_RefNannyDeclarations
22931  PyObject *__pyx_t_1 = NULL;
22932  PyObject *__pyx_t_2 = NULL;
22933  PyObject *__pyx_t_3 = NULL;
22934  int __pyx_t_4;
22935  PyObject *__pyx_t_5 = NULL;
22936  PyObject *__pyx_t_6 = NULL;
22937  PyObject *__pyx_t_7 = NULL;
22938  PyObject *__pyx_t_8 = NULL;
22939  __Pyx_RefNannySetupContext("import_ufunc", 0);
22940 
22941  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":998
22942  *
22943  * cdef inline int import_ufunc() except -1:
22944  * try: # <<<<<<<<<<<<<<
22945  * _import_umath()
22946  * except Exception:
22947  */
22948  {
22949  __Pyx_PyThreadState_declare
22950  __Pyx_PyThreadState_assign
22951  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
22952  __Pyx_XGOTREF(__pyx_t_1);
22953  __Pyx_XGOTREF(__pyx_t_2);
22954  __Pyx_XGOTREF(__pyx_t_3);
22955  /*try:*/ {
22956 
22957  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":999
22958  * cdef inline int import_ufunc() except -1:
22959  * try:
22960  * _import_umath() # <<<<<<<<<<<<<<
22961  * except Exception:
22962  * raise ImportError("numpy.core.umath failed to import")
22963  */
22964  __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(1, 999, __pyx_L3_error)
22965 
22966  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":998
22967  *
22968  * cdef inline int import_ufunc() except -1:
22969  * try: # <<<<<<<<<<<<<<
22970  * _import_umath()
22971  * except Exception:
22972  */
22973  }
22974  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
22975  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
22976  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
22977  goto __pyx_L10_try_end;
22978  __pyx_L3_error:;
22979  __Pyx_PyThreadState_assign
22980 
22981  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1000
22982  * try:
22983  * _import_umath()
22984  * except Exception: # <<<<<<<<<<<<<<
22985  * raise ImportError("numpy.core.umath failed to import")
22986  */
22987  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
22988  if (__pyx_t_4) {
22989  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
22990  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1000, __pyx_L5_except_error)
22991  __Pyx_GOTREF(__pyx_t_5);
22992  __Pyx_GOTREF(__pyx_t_6);
22993  __Pyx_GOTREF(__pyx_t_7);
22994 
22995  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1001
22996  * _import_umath()
22997  * except Exception:
22998  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
22999  */
23000  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1001, __pyx_L5_except_error)
23001  __Pyx_GOTREF(__pyx_t_8);
23002  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
23003  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
23004  __PYX_ERR(1, 1001, __pyx_L5_except_error)
23005  }
23006  goto __pyx_L5_except_error;
23007  __pyx_L5_except_error:;
23008 
23009  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":998
23010  *
23011  * cdef inline int import_ufunc() except -1:
23012  * try: # <<<<<<<<<<<<<<
23013  * _import_umath()
23014  * except Exception:
23015  */
23016  __Pyx_PyThreadState_assign
23017  __Pyx_XGIVEREF(__pyx_t_1);
23018  __Pyx_XGIVEREF(__pyx_t_2);
23019  __Pyx_XGIVEREF(__pyx_t_3);
23020  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
23021  goto __pyx_L1_error;
23022  __pyx_L10_try_end:;
23023  }
23024 
23025  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":997
23026  * raise ImportError("numpy.core.umath failed to import")
23027  *
23028  * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
23029  * try:
23030  * _import_umath()
23031  */
23032 
23033  /* function exit code */
23034  __pyx_r = 0;
23035  goto __pyx_L0;
23036  __pyx_L1_error:;
23037  __Pyx_XDECREF(__pyx_t_5);
23038  __Pyx_XDECREF(__pyx_t_6);
23039  __Pyx_XDECREF(__pyx_t_7);
23040  __Pyx_XDECREF(__pyx_t_8);
23041  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
23042  __pyx_r = -1;
23043  __pyx_L0:;
23044  __Pyx_RefNannyFinishContext();
23045  return __pyx_r;
23046 }
23047 
23048 static PyMethodDef __pyx_methods[] = {
23049  {0, 0, 0, 0}
23050 };
23051 
23052 #if PY_MAJOR_VERSION >= 3
23053 static struct PyModuleDef __pyx_moduledef = {
23054  #if PY_VERSION_HEX < 0x03020000
23055  { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
23056  #else
23057  PyModuleDef_HEAD_INIT,
23058  #endif
23059  "subsurfaceTransportFunctions",
23060  0, /* m_doc */
23061  -1, /* m_size */
23062  __pyx_methods /* m_methods */,
23063  NULL, /* m_reload */
23064  NULL, /* m_traverse */
23065  NULL, /* m_clear */
23066  NULL /* m_free */
23067 };
23068 #endif
23069 
23070 static __Pyx_StringTabEntry __pyx_string_tab[] = {
23071  {&__pyx_n_s_DKWr_DpsiC, __pyx_k_DKWr_DpsiC, sizeof(__pyx_k_DKWr_DpsiC), 0, 0, 1, 1},
23072  {&__pyx_n_s_DsBar_DpsiC, __pyx_k_DsBar_DpsiC, sizeof(__pyx_k_DsBar_DpsiC), 0, 0, 1, 1},
23073  {&__pyx_n_s_DthetaW_DpsiC, __pyx_k_DthetaW_DpsiC, sizeof(__pyx_k_DthetaW_DpsiC), 0, 0, 1, 1},
23074  {&__pyx_n_s_DvBar_DpsiC, __pyx_k_DvBar_DpsiC, sizeof(__pyx_k_DvBar_DpsiC), 0, 0, 1, 1},
23075  {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0},
23076  {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0},
23077  {&__pyx_n_s_I, __pyx_k_I, sizeof(__pyx_k_I), 0, 0, 1, 1},
23078  {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
23079  {&__pyx_n_s_J, __pyx_k_J, sizeof(__pyx_k_J), 0, 0, 1, 1},
23080  {&__pyx_n_s_KWr, __pyx_k_KWr, sizeof(__pyx_k_KWr), 0, 0, 1, 1},
23081  {&__pyx_n_s_KWs, __pyx_k_KWs, sizeof(__pyx_k_KWs), 0, 0, 1, 1},
23082  {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0},
23083  {&__pyx_n_s_RE_NCP1_evaluateElementCoefficie, __pyx_k_RE_NCP1_evaluateElementCoefficie, sizeof(__pyx_k_RE_NCP1_evaluateElementCoefficie), 0, 0, 1, 1},
23084  {&__pyx_n_s_RE_NCP1_evaluateElementCoefficie_2, __pyx_k_RE_NCP1_evaluateElementCoefficie_2, sizeof(__pyx_k_RE_NCP1_evaluateElementCoefficie_2), 0, 0, 1, 1},
23085  {&__pyx_n_s_RE_NCP1_getElementJacobian, __pyx_k_RE_NCP1_getElementJacobian, sizeof(__pyx_k_RE_NCP1_getElementJacobian), 0, 0, 1, 1},
23086  {&__pyx_n_s_RE_NCP1_getElementResidual, __pyx_k_RE_NCP1_getElementResidual, sizeof(__pyx_k_RE_NCP1_getElementResidual), 0, 0, 1, 1},
23087  {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
23088  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
23089  {&__pyx_n_s_a_avg, __pyx_k_a_avg, sizeof(__pyx_k_a_avg), 0, 0, 1, 1},
23090  {&__pyx_n_s_a_eN, __pyx_k_a_eN, sizeof(__pyx_k_a_eN), 0, 0, 1, 1},
23091  {&__pyx_n_s_a_neig, __pyx_k_a_neig, sizeof(__pyx_k_a_neig), 0, 0, 1, 1},
23092  {&__pyx_n_s_a_up, __pyx_k_a_up, sizeof(__pyx_k_a_up), 0, 0, 1, 1},
23093  {&__pyx_n_s_alpha, __pyx_k_alpha, sizeof(__pyx_k_alpha), 0, 0, 1, 1},
23094  {&__pyx_n_s_beta, __pyx_k_beta, sizeof(__pyx_k_beta), 0, 0, 1, 1},
23095  {&__pyx_n_s_calculateNormalFlux, __pyx_k_calculateNormalFlux, sizeof(__pyx_k_calculateNormalFlux), 0, 0, 1, 1},
23096  {&__pyx_n_s_characteristic_velocity, __pyx_k_characteristic_velocity, sizeof(__pyx_k_characteristic_velocity), 0, 0, 1, 1},
23097  {&__pyx_n_s_characteristic_velocity_dofs, __pyx_k_characteristic_velocity_dofs, sizeof(__pyx_k_characteristic_velocity_dofs), 0, 0, 1, 1},
23098  {&__pyx_n_s_clock, __pyx_k_clock, sizeof(__pyx_k_clock), 0, 0, 1, 1},
23099  {&__pyx_n_s_colind, __pyx_k_colind, sizeof(__pyx_k_colind), 0, 0, 1, 1},
23100  {&__pyx_n_s_computeSimpleCharacteristicVeloc, __pyx_k_computeSimpleCharacteristicVeloc, sizeof(__pyx_k_computeSimpleCharacteristicVeloc), 0, 0, 1, 1},
23101  {&__pyx_n_s_computeSimpleCharacteristicVeloc_2, __pyx_k_computeSimpleCharacteristicVeloc_2, sizeof(__pyx_k_computeSimpleCharacteristicVeloc_2), 0, 0, 1, 1},
23102  {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1},
23103  {&__pyx_n_s_dS, __pyx_k_dS, sizeof(__pyx_k_dS), 0, 0, 1, 1},
23104  {&__pyx_n_s_dV, __pyx_k_dV, sizeof(__pyx_k_dV), 0, 0, 1, 1},
23105  {&__pyx_n_s_denom, __pyx_k_denom, sizeof(__pyx_k_denom), 0, 0, 1, 1},
23106  {&__pyx_n_s_df, __pyx_k_df, sizeof(__pyx_k_df), 0, 0, 1, 1},
23107  {&__pyx_n_s_df_dofs, __pyx_k_df_dofs, sizeof(__pyx_k_df_dofs), 0, 0, 1, 1},
23108  {&__pyx_n_s_dkr_up, __pyx_k_dkr_up, sizeof(__pyx_k_dkr_up), 0, 0, 1, 1},
23109  {&__pyx_n_s_dm, __pyx_k_dm, sizeof(__pyx_k_dm), 0, 0, 1, 1},
23110  {&__pyx_n_s_dmt, __pyx_k_dmt, sizeof(__pyx_k_dmt), 0, 0, 1, 1},
23111  {&__pyx_n_s_dmtj_avg, __pyx_k_dmtj_avg, sizeof(__pyx_k_dmtj_avg), 0, 0, 1, 1},
23112  {&__pyx_n_s_dot, __pyx_k_dot, sizeof(__pyx_k_dot), 0, 0, 1, 1},
23113  {&__pyx_n_s_drhom, __pyx_k_drhom, sizeof(__pyx_k_drhom), 0, 0, 1, 1},
23114  {&__pyx_n_s_eN, __pyx_k_eN, sizeof(__pyx_k_eN), 0, 0, 1, 1},
23115  {&__pyx_n_s_eN_left, __pyx_k_eN_left, sizeof(__pyx_k_eN_left), 0, 0, 1, 1},
23116  {&__pyx_n_s_eN_neighbor, __pyx_k_eN_neighbor, sizeof(__pyx_k_eN_neighbor), 0, 0, 1, 1},
23117  {&__pyx_n_s_eN_right, __pyx_k_eN_right, sizeof(__pyx_k_eN_right), 0, 0, 1, 1},
23118  {&__pyx_n_s_ebN, __pyx_k_ebN, sizeof(__pyx_k_ebN), 0, 0, 1, 1},
23119  {&__pyx_n_s_ebNE, __pyx_k_ebNE, sizeof(__pyx_k_ebNE), 0, 0, 1, 1},
23120  {&__pyx_n_s_ebN_local, __pyx_k_ebN_local, sizeof(__pyx_k_ebN_local), 0, 0, 1, 1},
23121  {&__pyx_n_s_ebq_global_vals, __pyx_k_ebq_global_vals, sizeof(__pyx_k_ebq_global_vals), 0, 0, 1, 1},
23122  {&__pyx_n_s_ebq_vals, __pyx_k_ebq_vals, sizeof(__pyx_k_ebq_vals), 0, 0, 1, 1},
23123  {&__pyx_n_s_elementBarycentersArray, __pyx_k_elementBarycentersArray, sizeof(__pyx_k_elementBarycentersArray), 0, 0, 1, 1},
23124  {&__pyx_n_s_elementBoundariesArray, __pyx_k_elementBoundariesArray, sizeof(__pyx_k_elementBoundariesArray), 0, 0, 1, 1},
23125  {&__pyx_n_s_elementBoundaryElementsArray, __pyx_k_elementBoundaryElementsArray, sizeof(__pyx_k_elementBoundaryElementsArray), 0, 0, 1, 1},
23126  {&__pyx_n_s_elementBoundaryMaterialTypes, __pyx_k_elementBoundaryMaterialTypes, sizeof(__pyx_k_elementBoundaryMaterialTypes), 0, 0, 1, 1},
23127  {&__pyx_n_s_elementBoundaryTypes, __pyx_k_elementBoundaryTypes, sizeof(__pyx_k_elementBoundaryTypes), 0, 0, 1, 1},
23128  {&__pyx_n_s_elementJacobian, __pyx_k_elementJacobian, sizeof(__pyx_k_elementJacobian), 0, 0, 1, 1},
23129  {&__pyx_n_s_elementMaterialTypes, __pyx_k_elementMaterialTypes, sizeof(__pyx_k_elementMaterialTypes), 0, 0, 1, 1},
23130  {&__pyx_n_s_elementNeighborsArray, __pyx_k_elementNeighborsArray, sizeof(__pyx_k_elementNeighborsArray), 0, 0, 1, 1},
23131  {&__pyx_n_s_elementResidual, __pyx_k_elementResidual, sizeof(__pyx_k_elementResidual), 0, 0, 1, 1},
23132  {&__pyx_n_s_evaluateScalarMaterialFunctionOv, __pyx_k_evaluateScalarMaterialFunctionOv, sizeof(__pyx_k_evaluateScalarMaterialFunctionOv), 0, 0, 1, 1},
23133  {&__pyx_n_s_evaluateScalarMaterialFunctionOv_2, __pyx_k_evaluateScalarMaterialFunctionOv_2, sizeof(__pyx_k_evaluateScalarMaterialFunctionOv_2), 0, 0, 1, 1},
23134  {&__pyx_n_s_evaluateScalarMaterialFunctionOv_3, __pyx_k_evaluateScalarMaterialFunctionOv_3, sizeof(__pyx_k_evaluateScalarMaterialFunctionOv_3), 0, 0, 1, 1},
23135  {&__pyx_n_s_evaluateSparseTensorMaterialFunc, __pyx_k_evaluateSparseTensorMaterialFunc, sizeof(__pyx_k_evaluateSparseTensorMaterialFunc), 0, 0, 1, 1},
23136  {&__pyx_n_s_evaluateSparseTensorMaterialFunc_2, __pyx_k_evaluateSparseTensorMaterialFunc_2, sizeof(__pyx_k_evaluateSparseTensorMaterialFunc_2), 0, 0, 1, 1},
23137  {&__pyx_n_s_evaluateVectorMaterialFunctionOv, __pyx_k_evaluateVectorMaterialFunctionOv, sizeof(__pyx_k_evaluateVectorMaterialFunctionOv), 0, 0, 1, 1},
23138  {&__pyx_n_s_exteriorElementBoundariesArray, __pyx_k_exteriorElementBoundariesArray, sizeof(__pyx_k_exteriorElementBoundariesArray), 0, 0, 1, 1},
23139  {&__pyx_n_s_exteriorElementBoundaryMaterialT, __pyx_k_exteriorElementBoundaryMaterialT, sizeof(__pyx_k_exteriorElementBoundaryMaterialT), 0, 0, 1, 1},
23140  {&__pyx_n_s_f_up, __pyx_k_f_up, sizeof(__pyx_k_f_up), 0, 0, 1, 1},
23141  {&__pyx_n_s_flat, __pyx_k_flat, sizeof(__pyx_k_flat), 0, 0, 1, 1},
23142  {&__pyx_n_s_flux, __pyx_k_flux, sizeof(__pyx_k_flux), 0, 0, 1, 1},
23143  {&__pyx_n_s_gravity, __pyx_k_gravity, sizeof(__pyx_k_gravity), 0, 0, 1, 1},
23144  {&__pyx_n_s_helicalElementVelocityEval3, __pyx_k_helicalElementVelocityEval3, sizeof(__pyx_k_helicalElementVelocityEval3), 0, 0, 1, 1},
23145  {&__pyx_n_s_helicalElementVelocityEval4, __pyx_k_helicalElementVelocityEval4, sizeof(__pyx_k_helicalElementVelocityEval4), 0, 0, 1, 1},
23146  {&__pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_k_home_cekees_proteus_proteus_sub, sizeof(__pyx_k_home_cekees_proteus_proteus_sub), 0, 0, 1, 0},
23147  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
23148  {&__pyx_n_s_ii, __pyx_k_ii, sizeof(__pyx_k_ii), 0, 0, 1, 1},
23149  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
23150  {&__pyx_n_s_integral, __pyx_k_integral, sizeof(__pyx_k_integral), 0, 0, 1, 1},
23151  {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1},
23152  {&__pyx_n_s_jacobian_weak_residual, __pyx_k_jacobian_weak_residual, sizeof(__pyx_k_jacobian_weak_residual), 0, 0, 1, 1},
23153  {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
23154  {&__pyx_n_s_kb, __pyx_k_kb, sizeof(__pyx_k_kb), 0, 0, 1, 1},
23155  {&__pyx_n_s_kr_eN, __pyx_k_kr_eN, sizeof(__pyx_k_kr_eN), 0, 0, 1, 1},
23156  {&__pyx_n_s_kr_neig, __pyx_k_kr_neig, sizeof(__pyx_k_kr_neig), 0, 0, 1, 1},
23157  {&__pyx_n_s_l2g, __pyx_k_l2g, sizeof(__pyx_k_l2g), 0, 0, 1, 1},
23158  {&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1},
23159  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
23160  {&__pyx_n_s_matID, __pyx_k_matID, sizeof(__pyx_k_matID), 0, 0, 1, 1},
23161  {&__pyx_n_s_matID_neig, __pyx_k_matID_neig, sizeof(__pyx_k_matID_neig), 0, 0, 1, 1},
23162  {&__pyx_n_s_material, __pyx_k_material, sizeof(__pyx_k_material), 0, 0, 1, 1},
23163  {&__pyx_n_s_material_functions, __pyx_k_material_functions, sizeof(__pyx_k_material_functions), 0, 0, 1, 1},
23164  {&__pyx_n_s_material_left, __pyx_k_material_left, sizeof(__pyx_k_material_left), 0, 0, 1, 1},
23165  {&__pyx_n_s_material_right, __pyx_k_material_right, sizeof(__pyx_k_material_right), 0, 0, 1, 1},
23166  {&__pyx_n_s_mt, __pyx_k_mt, sizeof(__pyx_k_mt), 0, 0, 1, 1},
23167  {&__pyx_n_s_mt_avg, __pyx_k_mt_avg, sizeof(__pyx_k_mt_avg), 0, 0, 1, 1},
23168  {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
23169  {&__pyx_n_s_nAvgWeight, __pyx_k_nAvgWeight, sizeof(__pyx_k_nAvgWeight), 0, 0, 1, 1},
23170  {&__pyx_n_s_nDOF_test_element, __pyx_k_nDOF_test_element, sizeof(__pyx_k_nDOF_test_element), 0, 0, 1, 1},
23171  {&__pyx_n_s_nDOF_trial_element, __pyx_k_nDOF_trial_element, sizeof(__pyx_k_nDOF_trial_element), 0, 0, 1, 1},
23172  {&__pyx_n_s_nElementBoundaries_element, __pyx_k_nElementBoundaries_element, sizeof(__pyx_k_nElementBoundaries_element), 0, 0, 1, 1},
23173  {&__pyx_n_s_nElementBoundaries_global, __pyx_k_nElementBoundaries_global, sizeof(__pyx_k_nElementBoundaries_global), 0, 0, 1, 1},
23174  {&__pyx_n_s_nElements_global, __pyx_k_nElements_global, sizeof(__pyx_k_nElements_global), 0, 0, 1, 1},
23175  {&__pyx_n_s_nExteriorElementBoundaries_globa, __pyx_k_nExteriorElementBoundaries_globa, sizeof(__pyx_k_nExteriorElementBoundaries_globa), 0, 0, 1, 1},
23176  {&__pyx_n_s_nSpace, __pyx_k_nSpace, sizeof(__pyx_k_nSpace), 0, 0, 1, 1},
23177  {&__pyx_n_s_nSpace2, __pyx_k_nSpace2, sizeof(__pyx_k_nSpace2), 0, 0, 1, 1},
23178  {&__pyx_n_s_nd, __pyx_k_nd, sizeof(__pyx_k_nd), 0, 0, 1, 1},
23179  {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0},
23180  {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0},
23181  {&__pyx_n_s_nnz, __pyx_k_nnz, sizeof(__pyx_k_nnz), 0, 0, 1, 1},
23182  {&__pyx_n_s_numer, __pyx_k_numer, sizeof(__pyx_k_numer), 0, 0, 1, 1},
23183  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
23184  {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0},
23185  {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0},
23186  {&__pyx_n_s_omega_e, __pyx_k_omega_e, sizeof(__pyx_k_omega_e), 0, 0, 1, 1},
23187  {&__pyx_n_s_one8, __pyx_k_one8, sizeof(__pyx_k_one8), 0, 0, 1, 1},
23188  {&__pyx_n_s_onePlus_pcBar_n, __pyx_k_onePlus_pcBar_n, sizeof(__pyx_k_onePlus_pcBar_n), 0, 0, 1, 1},
23189  {&__pyx_n_s_pcBar, __pyx_k_pcBar, sizeof(__pyx_k_pcBar), 0, 0, 1, 1},
23190  {&__pyx_n_s_pcBar_n, __pyx_k_pcBar_n, sizeof(__pyx_k_pcBar_n), 0, 0, 1, 1},
23191  {&__pyx_n_s_pcBar_nM1, __pyx_k_pcBar_nM1, sizeof(__pyx_k_pcBar_nM1), 0, 0, 1, 1},
23192  {&__pyx_n_s_pcBar_nM2, __pyx_k_pcBar_nM2, sizeof(__pyx_k_pcBar_nM2), 0, 0, 1, 1},
23193  {&__pyx_n_s_phi_eN, __pyx_k_phi_eN, sizeof(__pyx_k_phi_eN), 0, 0, 1, 1},
23194  {&__pyx_n_s_phi_neig, __pyx_k_phi_neig, sizeof(__pyx_k_phi_neig), 0, 0, 1, 1},
23195  {&__pyx_n_s_pi, __pyx_k_pi, sizeof(__pyx_k_pi), 0, 0, 1, 1},
23196  {&__pyx_n_s_picard, __pyx_k_picard, sizeof(__pyx_k_picard), 0, 0, 1, 1},
23197  {&__pyx_n_s_psiC, __pyx_k_psiC, sizeof(__pyx_k_psiC), 0, 0, 1, 1},
23198  {&__pyx_n_s_q, __pyx_k_q, sizeof(__pyx_k_q), 0, 0, 1, 1},
23199  {&__pyx_n_s_q_alin, __pyx_k_q_alin, sizeof(__pyx_k_q_alin), 0, 0, 1, 1},
23200  {&__pyx_n_s_q_detJ, __pyx_k_q_detJ, sizeof(__pyx_k_q_detJ), 0, 0, 1, 1},
23201  {&__pyx_n_s_q_dkr, __pyx_k_q_dkr, sizeof(__pyx_k_q_dkr), 0, 0, 1, 1},
23202  {&__pyx_n_s_q_dm, __pyx_k_q_dm, sizeof(__pyx_k_q_dm), 0, 0, 1, 1},
23203  {&__pyx_n_s_q_dmass, __pyx_k_q_dmass, sizeof(__pyx_k_q_dmass), 0, 0, 1, 1},
23204  {&__pyx_n_s_q_dmt, __pyx_k_q_dmt, sizeof(__pyx_k_q_dmt), 0, 0, 1, 1},
23205  {&__pyx_n_s_q_flin, __pyx_k_q_flin, sizeof(__pyx_k_q_flin), 0, 0, 1, 1},
23206  {&__pyx_n_s_q_grad_u, __pyx_k_q_grad_u, sizeof(__pyx_k_q_grad_u), 0, 0, 1, 1},
23207  {&__pyx_n_s_q_grad_v, __pyx_k_q_grad_v, sizeof(__pyx_k_q_grad_v), 0, 0, 1, 1},
23208  {&__pyx_n_s_q_grad_w, __pyx_k_q_grad_w, sizeof(__pyx_k_q_grad_w), 0, 0, 1, 1},
23209  {&__pyx_n_s_q_kr, __pyx_k_q_kr, sizeof(__pyx_k_q_kr), 0, 0, 1, 1},
23210  {&__pyx_n_s_q_kr_up, __pyx_k_q_kr_up, sizeof(__pyx_k_q_kr_up), 0, 0, 1, 1},
23211  {&__pyx_n_s_q_m, __pyx_k_q_m, sizeof(__pyx_k_q_m), 0, 0, 1, 1},
23212  {&__pyx_n_s_q_mass, __pyx_k_q_mass, sizeof(__pyx_k_q_mass), 0, 0, 1, 1},
23213  {&__pyx_n_s_q_mt, __pyx_k_q_mt, sizeof(__pyx_k_q_mt), 0, 0, 1, 1},
23214  {&__pyx_n_s_q_r, __pyx_k_q_r, sizeof(__pyx_k_q_r), 0, 0, 1, 1},
23215  {&__pyx_n_s_q_u, __pyx_k_q_u, sizeof(__pyx_k_q_u), 0, 0, 1, 1},
23216  {&__pyx_n_s_q_vals, __pyx_k_q_vals, sizeof(__pyx_k_q_vals), 0, 0, 1, 1},
23217  {&__pyx_n_s_q_x, __pyx_k_q_x, sizeof(__pyx_k_q_x), 0, 0, 1, 1},
23218  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
23219  {&__pyx_n_s_rho, __pyx_k_rho, sizeof(__pyx_k_rho), 0, 0, 1, 1},
23220  {&__pyx_n_s_rho2, __pyx_k_rho2, sizeof(__pyx_k_rho2), 0, 0, 1, 1},
23221  {&__pyx_n_s_rhom, __pyx_k_rhom, sizeof(__pyx_k_rhom), 0, 0, 1, 1},
23222  {&__pyx_n_s_rotatingGaussianElementVelocityE, __pyx_k_rotatingGaussianElementVelocityE, sizeof(__pyx_k_rotatingGaussianElementVelocityE), 0, 0, 1, 1},
23223  {&__pyx_n_s_rotatingGaussianElementVelocityE_2, __pyx_k_rotatingGaussianElementVelocityE_2, sizeof(__pyx_k_rotatingGaussianElementVelocityE_2), 0, 0, 1, 1},
23224  {&__pyx_n_s_rowptr, __pyx_k_rowptr, sizeof(__pyx_k_rowptr), 0, 0, 1, 1},
23225  {&__pyx_n_s_sBar, __pyx_k_sBar, sizeof(__pyx_k_sBar), 0, 0, 1, 1},
23226  {&__pyx_n_s_setElementBoundariesArray, __pyx_k_setElementBoundariesArray, sizeof(__pyx_k_setElementBoundariesArray), 0, 0, 1, 1},
23227  {&__pyx_n_s_setExteriorElementBoundaryTypes, __pyx_k_setExteriorElementBoundaryTypes, sizeof(__pyx_k_setExteriorElementBoundaryTypes), 0, 0, 1, 1},
23228  {&__pyx_n_s_setScalarMaterialFunctionOverEle, __pyx_k_setScalarMaterialFunctionOverEle, sizeof(__pyx_k_setScalarMaterialFunctionOverEle), 0, 0, 1, 1},
23229  {&__pyx_n_s_setScalarMaterialFunctionOverEle_2, __pyx_k_setScalarMaterialFunctionOverEle_2, sizeof(__pyx_k_setScalarMaterialFunctionOverEle_2), 0, 0, 1, 1},
23230  {&__pyx_n_s_setScalarMaterialFunctionOverGlo, __pyx_k_setScalarMaterialFunctionOverGlo, sizeof(__pyx_k_setScalarMaterialFunctionOverGlo), 0, 0, 1, 1},
23231  {&__pyx_n_s_setSparseTensorMaterialFunctionO, __pyx_k_setSparseTensorMaterialFunctionO, sizeof(__pyx_k_setSparseTensorMaterialFunctionO), 0, 0, 1, 1},
23232  {&__pyx_n_s_setSparseTensorMaterialFunctionO_2, __pyx_k_setSparseTensorMaterialFunctionO_2, sizeof(__pyx_k_setSparseTensorMaterialFunctionO_2), 0, 0, 1, 1},
23233  {&__pyx_n_s_setVectorMaterialFunctionOverEle, __pyx_k_setVectorMaterialFunctionOverEle, sizeof(__pyx_k_setVectorMaterialFunctionOverEle), 0, 0, 1, 1},
23234  {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
23235  {&__pyx_n_s_sqrt_sBar, __pyx_k_sqrt_sBar, sizeof(__pyx_k_sqrt_sBar), 0, 0, 1, 1},
23236  {&__pyx_n_s_subsurfaceTransportFunctions, __pyx_k_subsurfaceTransportFunctions, sizeof(__pyx_k_subsurfaceTransportFunctions), 0, 0, 1, 1},
23237  {&__pyx_n_s_sum, __pyx_k_sum, sizeof(__pyx_k_sum), 0, 0, 1, 1},
23238  {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1},
23239  {&__pyx_n_s_tForReversal, __pyx_k_tForReversal, sizeof(__pyx_k_tForReversal), 0, 0, 1, 1},
23240  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
23241  {&__pyx_n_s_thetaR, __pyx_k_thetaR, sizeof(__pyx_k_thetaR), 0, 0, 1, 1},
23242  {&__pyx_n_s_thetaS, __pyx_k_thetaS, sizeof(__pyx_k_thetaS), 0, 0, 1, 1},
23243  {&__pyx_n_s_thetaSR, __pyx_k_thetaSR, sizeof(__pyx_k_thetaSR), 0, 0, 1, 1},
23244  {&__pyx_n_s_thetaW, __pyx_k_thetaW, sizeof(__pyx_k_thetaW), 0, 0, 1, 1},
23245  {&__pyx_n_s_thisElementIsUpwind, __pyx_k_thisElementIsUpwind, sizeof(__pyx_k_thisElementIsUpwind), 0, 0, 1, 1},
23246  {&__pyx_n_s_transient, __pyx_k_transient, sizeof(__pyx_k_transient), 0, 0, 1, 1},
23247  {&__pyx_n_s_u_dof, __pyx_k_u_dof, sizeof(__pyx_k_u_dof), 0, 0, 1, 1},
23248  {&__pyx_n_s_u_eN, __pyx_k_u_eN, sizeof(__pyx_k_u_eN), 0, 0, 1, 1},
23249  {&__pyx_n_s_u_j, __pyx_k_u_j, sizeof(__pyx_k_u_j), 0, 0, 1, 1},
23250  {&__pyx_n_s_u_l2g, __pyx_k_u_l2g, sizeof(__pyx_k_u_l2g), 0, 0, 1, 1},
23251  {&__pyx_n_s_u_neig, __pyx_k_u_neig, sizeof(__pyx_k_u_neig), 0, 0, 1, 1},
23252  {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0},
23253  {&__pyx_n_s_updateMassJacobian_weakAvg, __pyx_k_updateMassJacobian_weakAvg, sizeof(__pyx_k_updateMassJacobian_weakAvg), 0, 0, 1, 1},
23254  {&__pyx_n_s_updateMass_weakAvg, __pyx_k_updateMass_weakAvg, sizeof(__pyx_k_updateMass_weakAvg), 0, 0, 1, 1},
23255  {&__pyx_n_s_upwindFlag, __pyx_k_upwindFlag, sizeof(__pyx_k_upwindFlag), 0, 0, 1, 1},
23256  {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
23257  {&__pyx_n_s_vBar, __pyx_k_vBar, sizeof(__pyx_k_vBar), 0, 0, 1, 1},
23258  {&__pyx_n_s_vBar2, __pyx_k_vBar2, sizeof(__pyx_k_vBar2), 0, 0, 1, 1},
23259  {&__pyx_n_s_vol, __pyx_k_vol, sizeof(__pyx_k_vol), 0, 0, 1, 1},
23260  {&__pyx_n_s_volFactor, __pyx_k_volFactor, sizeof(__pyx_k_volFactor), 0, 0, 1, 1},
23261  {&__pyx_n_s_vol_e, __pyx_k_vol_e, sizeof(__pyx_k_vol_e), 0, 0, 1, 1},
23262  {&__pyx_n_s_volume, __pyx_k_volume, sizeof(__pyx_k_volume), 0, 0, 1, 1},
23263  {&__pyx_n_s_vortexElementVelocityEval3, __pyx_k_vortexElementVelocityEval3, sizeof(__pyx_k_vortexElementVelocityEval3), 0, 0, 1, 1},
23264  {&__pyx_n_s_vortexElementVelocityEval4, __pyx_k_vortexElementVelocityEval4, sizeof(__pyx_k_vortexElementVelocityEval4), 0, 0, 1, 1},
23265  {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1},
23266  {&__pyx_n_s_weak_residual, __pyx_k_weak_residual, sizeof(__pyx_k_weak_residual), 0, 0, 1, 1},
23267  {&__pyx_n_s_weight, __pyx_k_weight, sizeof(__pyx_k_weight), 0, 0, 1, 1},
23268  {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
23269  {&__pyx_n_s_xc, __pyx_k_xc, sizeof(__pyx_k_xc), 0, 0, 1, 1},
23270  {&__pyx_n_s_yc, __pyx_k_yc, sizeof(__pyx_k_yc), 0, 0, 1, 1},
23271  {&__pyx_n_s_zVelocity, __pyx_k_zVelocity, sizeof(__pyx_k_zVelocity), 0, 0, 1, 1},
23272  {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
23273  {&__pyx_n_s_zvelocity, __pyx_k_zvelocity, sizeof(__pyx_k_zvelocity), 0, 0, 1, 1},
23274  {0, 0, 0, 0, 0, 0, 0}
23275 };
23276 static int __Pyx_InitCachedBuiltins(void) {
23277  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 24, __pyx_L1_error)
23278  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 218, __pyx_L1_error)
23279  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 799, __pyx_L1_error)
23280  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 989, __pyx_L1_error)
23281  return 0;
23282  __pyx_L1_error:;
23283  return -1;
23284 }
23285 
23286 static int __Pyx_InitCachedConstants(void) {
23287  __Pyx_RefNannyDeclarations
23288  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
23289 
23290  /* "subsurfaceTransportFunctions.pyx":66
23291  * material = elementMaterialTypes[eN]
23292  * for k in range(q_vals.shape[1]):
23293  * q_vals[eN,k,:] = material_functions[material].flat # <<<<<<<<<<<<<<
23294  *
23295  *
23296  */
23297  __pyx_slice_ = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice_)) __PYX_ERR(0, 66, __pyx_L1_error)
23298  __Pyx_GOTREF(__pyx_slice_);
23299  __Pyx_GIVEREF(__pyx_slice_);
23300 
23301  /* "subsurfaceTransportFunctions.pyx":192
23302  * material = elementMaterialTypes[eN]
23303  * for k in range(x.shape[1]):
23304  * q_vals[eN,k,:] = material_functions[material](x[eN,k],t).flat # <<<<<<<<<<<<<<
23305  *
23306  *
23307  */
23308  __pyx_slice__2 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 192, __pyx_L1_error)
23309  __Pyx_GOTREF(__pyx_slice__2);
23310  __Pyx_GIVEREF(__pyx_slice__2);
23311 
23312  /* "subsurfaceTransportFunctions.pyx":794
23313  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
23314  * v[eN,k,2]=zvelocity
23315  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
23316  * else:
23317  * for eN in range(x.shape[0]):
23318  */
23319  __pyx_slice__3 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__3)) __PYX_ERR(0, 794, __pyx_L1_error)
23320  __Pyx_GOTREF(__pyx_slice__3);
23321  __Pyx_GIVEREF(__pyx_slice__3);
23322 
23323  /* "subsurfaceTransportFunctions.pyx":808
23324  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
23325  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
23326  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
23327  * else:
23328  * for eN in range(x.shape[0]):
23329  */
23330  __pyx_slice__4 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__4)) __PYX_ERR(0, 808, __pyx_L1_error)
23331  __Pyx_GOTREF(__pyx_slice__4);
23332  __Pyx_GIVEREF(__pyx_slice__4);
23333 
23334  /* "subsurfaceTransportFunctions.pyx":835
23335  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
23336  * v[eN,ebN,k,2]=zvelocity
23337  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
23338  * else:
23339  * for eN in range(x.shape[0]):
23340  */
23341  __pyx_slice__5 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__5)) __PYX_ERR(0, 835, __pyx_L1_error)
23342  __Pyx_GOTREF(__pyx_slice__5);
23343  __Pyx_GIVEREF(__pyx_slice__5);
23344 
23345  /* "subsurfaceTransportFunctions.pyx":851
23346  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
23347  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
23348  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
23349  * else:
23350  * for eN in range(x.shape[0]):
23351  */
23352  __pyx_slice__6 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__6)) __PYX_ERR(0, 851, __pyx_L1_error)
23353  __Pyx_GOTREF(__pyx_slice__6);
23354  __Pyx_GIVEREF(__pyx_slice__6);
23355 
23356  /* "subsurfaceTransportFunctions.pyx":876
23357  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
23358  * v[eN,k,2]=zVelocity
23359  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0)) # <<<<<<<<<<<<<<
23360  * else:
23361  * for eN in range(x.shape[0]):
23362  */
23363  __pyx_slice__7 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__7)) __PYX_ERR(0, 876, __pyx_L1_error)
23364  __Pyx_GOTREF(__pyx_slice__7);
23365  __Pyx_GIVEREF(__pyx_slice__7);
23366 
23367  /* "subsurfaceTransportFunctions.pyx":902
23368  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
23369  * v[eN,ebN,k,2]=zVelocity
23370  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0)) # <<<<<<<<<<<<<<
23371  * else:
23372  * for eN in range(x.shape[0]):
23373  */
23374  __pyx_slice__8 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__8)) __PYX_ERR(0, 902, __pyx_L1_error)
23375  __Pyx_GOTREF(__pyx_slice__8);
23376  __Pyx_GIVEREF(__pyx_slice__8);
23377 
23378  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":218
23379  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
23380  * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
23381  * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
23382  *
23383  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
23384  */
23385  __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 218, __pyx_L1_error)
23386  __Pyx_GOTREF(__pyx_tuple__9);
23387  __Pyx_GIVEREF(__pyx_tuple__9);
23388 
23389  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":222
23390  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
23391  * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
23392  * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
23393  *
23394  * info.buf = PyArray_DATA(self)
23395  */
23396  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 222, __pyx_L1_error)
23397  __Pyx_GOTREF(__pyx_tuple__10);
23398  __Pyx_GIVEREF(__pyx_tuple__10);
23399 
23400  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":259
23401  * if ((descr.byteorder == c'>' and little_endian) or
23402  * (descr.byteorder == c'<' and not little_endian)):
23403  * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
23404  * if t == NPY_BYTE: f = "b"
23405  * elif t == NPY_UBYTE: f = "B"
23406  */
23407  __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 259, __pyx_L1_error)
23408  __Pyx_GOTREF(__pyx_tuple__11);
23409  __Pyx_GIVEREF(__pyx_tuple__11);
23410 
23411  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":799
23412  *
23413  * if (end - f) - <int>(new_offset - offset[0]) < 15:
23414  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
23415  *
23416  * if ((child.byteorder == c'>' and little_endian) or
23417  */
23418  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 799, __pyx_L1_error)
23419  __Pyx_GOTREF(__pyx_tuple__12);
23420  __Pyx_GIVEREF(__pyx_tuple__12);
23421 
23422  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":803
23423  * if ((child.byteorder == c'>' and little_endian) or
23424  * (child.byteorder == c'<' and not little_endian)):
23425  * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
23426  * # One could encode it in the format string and have Cython
23427  * # complain instead, BUT: < and > in format strings also imply
23428  */
23429  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 803, __pyx_L1_error)
23430  __Pyx_GOTREF(__pyx_tuple__13);
23431  __Pyx_GIVEREF(__pyx_tuple__13);
23432 
23433  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":823
23434  * t = child.type_num
23435  * if end - f < 5:
23436  * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
23437  *
23438  * # Until ticket #99 is fixed, use integers to avoid warnings
23439  */
23440  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 823, __pyx_L1_error)
23441  __Pyx_GOTREF(__pyx_tuple__14);
23442  __Pyx_GIVEREF(__pyx_tuple__14);
23443 
23444  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":989
23445  * _import_array()
23446  * except Exception:
23447  * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
23448  *
23449  * cdef inline int import_umath() except -1:
23450  */
23451  __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 989, __pyx_L1_error)
23452  __Pyx_GOTREF(__pyx_tuple__15);
23453  __Pyx_GIVEREF(__pyx_tuple__15);
23454 
23455  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":995
23456  * _import_umath()
23457  * except Exception:
23458  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
23459  *
23460  * cdef inline int import_ufunc() except -1:
23461  */
23462  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 995, __pyx_L1_error)
23463  __Pyx_GOTREF(__pyx_tuple__16);
23464  __Pyx_GIVEREF(__pyx_tuple__16);
23465 
23466  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1001
23467  * _import_umath()
23468  * except Exception:
23469  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
23470  */
23471  __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 1001, __pyx_L1_error)
23472  __Pyx_GOTREF(__pyx_tuple__17);
23473  __Pyx_GIVEREF(__pyx_tuple__17);
23474 
23475  /* "subsurfaceTransportFunctions.pyx":18
23476  * ctypedef int ITYPE_t
23477  *
23478  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global, # <<<<<<<<<<<<<<
23479  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundariesArray,
23480  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
23481  */
23482  __pyx_tuple__18 = PyTuple_Pack(8, __pyx_n_s_nExteriorElementBoundaries_globa, __pyx_n_s_exteriorElementBoundariesArray, __pyx_n_s_elementBoundaryElementsArray, __pyx_n_s_elementMaterialTypes, __pyx_n_s_exteriorElementBoundaryMaterialT, __pyx_n_s_ebNE, __pyx_n_s_ebN, __pyx_n_s_eN); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 18, __pyx_L1_error)
23483  __Pyx_GOTREF(__pyx_tuple__18);
23484  __Pyx_GIVEREF(__pyx_tuple__18);
23485  __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_setExteriorElementBoundaryTypes, 18, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 18, __pyx_L1_error)
23486 
23487  /* "subsurfaceTransportFunctions.pyx":29
23488  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
23489  *
23490  * def setElementBoundariesArray(int nElementBoundaries_global, # <<<<<<<<<<<<<<
23491  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
23492  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
23493  */
23494  __pyx_tuple__20 = PyTuple_Pack(7, __pyx_n_s_nElementBoundaries_global, __pyx_n_s_elementBoundaryElementsArray, __pyx_n_s_elementMaterialTypes, __pyx_n_s_elementBoundaryMaterialTypes, __pyx_n_s_ebN, __pyx_n_s_eN_left, __pyx_n_s_eN_right); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 29, __pyx_L1_error)
23495  __Pyx_GOTREF(__pyx_tuple__20);
23496  __Pyx_GIVEREF(__pyx_tuple__20);
23497  __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(4, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_setElementBoundariesArray, 29, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 29, __pyx_L1_error)
23498 
23499  /* "subsurfaceTransportFunctions.pyx":43
23500  *
23501  * ###
23502  * def setScalarMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
23503  * numpy.ndarray[DTYPE_t,ndim=2] q_vals,
23504  * dict material_functions):
23505  */
23506  __pyx_tuple__22 = PyTuple_Pack(6, __pyx_n_s_elementMaterialTypes, __pyx_n_s_q_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_material); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 43, __pyx_L1_error)
23507  __Pyx_GOTREF(__pyx_tuple__22);
23508  __Pyx_GIVEREF(__pyx_tuple__22);
23509  __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_setScalarMaterialFunctionOverEle, 43, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 43, __pyx_L1_error)
23510 
23511  /* "subsurfaceTransportFunctions.pyx":56
23512  * q_vals[eN,k] = material_functions[material]
23513  *
23514  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
23515  * numpy.ndarray[DTYPE_t,ndim=3] q_vals,
23516  * dict material_functions):
23517  */
23518  __pyx_tuple__24 = PyTuple_Pack(6, __pyx_n_s_elementMaterialTypes, __pyx_n_s_q_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_material); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 56, __pyx_L1_error)
23519  __Pyx_GOTREF(__pyx_tuple__24);
23520  __Pyx_GIVEREF(__pyx_tuple__24);
23521  __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_setVectorMaterialFunctionOverEle, 56, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 56, __pyx_L1_error)
23522 
23523  /* "subsurfaceTransportFunctions.pyx":69
23524  *
23525  *
23526  * def setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
23527  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23528  * numpy.ndarray[DTYPE_t,ndim=3] ebq_vals,
23529  */
23530  __pyx_tuple__26 = PyTuple_Pack(10, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_ebq_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_ebN_local, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 69, __pyx_L1_error)
23531  __Pyx_GOTREF(__pyx_tuple__26);
23532  __Pyx_GIVEREF(__pyx_tuple__26);
23533  __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(4, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_setScalarMaterialFunctionOverEle_2, 69, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 69, __pyx_L1_error)
23534 
23535  /* "subsurfaceTransportFunctions.pyx":91
23536  * material_functions[material_right])
23537  *
23538  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
23539  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23540  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23541  */
23542  __pyx_tuple__28 = PyTuple_Pack(15, __pyx_n_s_nd, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_ebq_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_ebN_local, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_numer, __pyx_n_s_denom); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 91, __pyx_L1_error)
23543  __Pyx_GOTREF(__pyx_tuple__28);
23544  __Pyx_GIVEREF(__pyx_tuple__28);
23545  __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(5, 0, 15, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_setSparseTensorMaterialFunctionO, 91, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 91, __pyx_L1_error)
23546 
23547  /* "subsurfaceTransportFunctions.pyx":118
23548  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
23549  *
23550  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
23551  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23552  * numpy.ndarray[DTYPE_t,ndim=2] ebq_global_vals,
23553  */
23554  __pyx_tuple__30 = PyTuple_Pack(8, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_ebq_global_vals, __pyx_n_s_material_functions, __pyx_n_s_ebN, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_k); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 118, __pyx_L1_error)
23555  __Pyx_GOTREF(__pyx_tuple__30);
23556  __Pyx_GIVEREF(__pyx_tuple__30);
23557  __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(4, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_setScalarMaterialFunctionOverGlo, 118, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 118, __pyx_L1_error)
23558 
23559  /* "subsurfaceTransportFunctions.pyx":139
23560  *
23561  *
23562  * def setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
23563  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23564  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23565  */
23566  __pyx_tuple__32 = PyTuple_Pack(13, __pyx_n_s_nd, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_ebq_global_vals, __pyx_n_s_material_functions, __pyx_n_s_ebN, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_numer, __pyx_n_s_denom); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 139, __pyx_L1_error)
23567  __Pyx_GOTREF(__pyx_tuple__32);
23568  __Pyx_GIVEREF(__pyx_tuple__32);
23569  __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(5, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_setSparseTensorMaterialFunctionO_2, 139, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 139, __pyx_L1_error)
23570 
23571  /* "subsurfaceTransportFunctions.pyx":165
23572  *
23573  * ###
23574  * def evaluateScalarMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
23575  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
23576  * numpy.ndarray[DTYPE_t,ndim=3] x,
23577  */
23578  __pyx_tuple__34 = PyTuple_Pack(8, __pyx_n_s_t, __pyx_n_s_elementMaterialTypes, __pyx_n_s_x, __pyx_n_s_q_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_material); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 165, __pyx_L1_error)
23579  __Pyx_GOTREF(__pyx_tuple__34);
23580  __Pyx_GIVEREF(__pyx_tuple__34);
23581  __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_evaluateScalarMaterialFunctionOv, 165, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 165, __pyx_L1_error)
23582 
23583  /* "subsurfaceTransportFunctions.pyx":180
23584  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
23585  *
23586  * def evaluateVectorMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
23587  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
23588  * numpy.ndarray[DTYPE_t,ndim=3] x,
23589  */
23590  __pyx_tuple__36 = PyTuple_Pack(8, __pyx_n_s_t, __pyx_n_s_elementMaterialTypes, __pyx_n_s_x, __pyx_n_s_q_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_material); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 180, __pyx_L1_error)
23591  __Pyx_GOTREF(__pyx_tuple__36);
23592  __Pyx_GIVEREF(__pyx_tuple__36);
23593  __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_evaluateVectorMaterialFunctionOv, 180, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 180, __pyx_L1_error)
23594 
23595  /* "subsurfaceTransportFunctions.pyx":195
23596  *
23597  *
23598  * def evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
23599  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23600  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23601  */
23602  __pyx_tuple__38 = PyTuple_Pack(12, __pyx_n_s_t, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_x, __pyx_n_s_ebq_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_ebN_local, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 195, __pyx_L1_error)
23603  __Pyx_GOTREF(__pyx_tuple__38);
23604  __Pyx_GIVEREF(__pyx_tuple__38);
23605  __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(6, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_evaluateScalarMaterialFunctionOv_2, 195, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 195, __pyx_L1_error)
23606 
23607  /* "subsurfaceTransportFunctions.pyx":219
23608  * material_functions[material_right](x[eN,ebN_local,k],t))
23609  *
23610  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
23611  * double t,
23612  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23613  */
23614  __pyx_tuple__40 = PyTuple_Pack(17, __pyx_n_s_nd, __pyx_n_s_t, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_x, __pyx_n_s_ebq_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_ebN_local, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_numer, __pyx_n_s_denom); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 219, __pyx_L1_error)
23615  __Pyx_GOTREF(__pyx_tuple__40);
23616  __Pyx_GIVEREF(__pyx_tuple__40);
23617  __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(7, 0, 17, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_evaluateSparseTensorMaterialFunc, 219, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 219, __pyx_L1_error)
23618 
23619  /* "subsurfaceTransportFunctions.pyx":248
23620  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
23621  *
23622  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
23623  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23624  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23625  */
23626  __pyx_tuple__42 = PyTuple_Pack(10, __pyx_n_s_t, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_x, __pyx_n_s_ebq_global_vals, __pyx_n_s_material_functions, __pyx_n_s_ebN, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_k); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 248, __pyx_L1_error)
23627  __Pyx_GOTREF(__pyx_tuple__42);
23628  __Pyx_GIVEREF(__pyx_tuple__42);
23629  __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(6, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_evaluateScalarMaterialFunctionOv_3, 248, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 248, __pyx_L1_error)
23630 
23631  /* "subsurfaceTransportFunctions.pyx":271
23632  *
23633  *
23634  * def evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
23635  * double t,
23636  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23637  */
23638  __pyx_tuple__44 = PyTuple_Pack(15, __pyx_n_s_nd, __pyx_n_s_t, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_x, __pyx_n_s_ebq_global_vals, __pyx_n_s_material_functions, __pyx_n_s_ebN, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_numer, __pyx_n_s_denom); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 271, __pyx_L1_error)
23639  __Pyx_GOTREF(__pyx_tuple__44);
23640  __Pyx_GIVEREF(__pyx_tuple__44);
23641  __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(7, 0, 15, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_evaluateSparseTensorMaterialFunc_2, 271, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 271, __pyx_L1_error)
23642 
23643  /* "subsurfaceTransportFunctions.pyx":301
23644  *
23645  * ##################################################
23646  * def RE_NCP1_evaluateElementCoefficients_Linear(double rho, # <<<<<<<<<<<<<<
23647  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
23648  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
23649  */
23650  __pyx_tuple__46 = PyTuple_Pack(24, __pyx_n_s_rho, __pyx_n_s_gravity, __pyx_n_s_rowptr, __pyx_n_s_colind, __pyx_n_s_KWs, __pyx_n_s_nSpace, __pyx_n_s_nElements_global, __pyx_n_s_nElementBoundaries_element, __pyx_n_s_elementNeighborsArray, __pyx_n_s_elementMaterialTypes, __pyx_n_s_q_flin, __pyx_n_s_q_alin, __pyx_n_s_eN, __pyx_n_s_eN_neighbor, __pyx_n_s_ii, __pyx_n_s_I, __pyx_n_s_ebN, __pyx_n_s_matID, __pyx_n_s_matID_neig, __pyx_n_s_nSpace2, __pyx_n_s_nnz, __pyx_n_s_a_eN, __pyx_n_s_a_neig, __pyx_n_s_a_avg); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 301, __pyx_L1_error)
23651  __Pyx_GOTREF(__pyx_tuple__46);
23652  __Pyx_GIVEREF(__pyx_tuple__46);
23653  __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(12, 0, 24, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_RE_NCP1_evaluateElementCoefficie, 301, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 301, __pyx_L1_error)
23654 
23655  /* "subsurfaceTransportFunctions.pyx":359
23656  *
23657  *
23658  * def RE_NCP1_evaluateElementCoefficients_VGM(double rho, # <<<<<<<<<<<<<<
23659  * double beta,
23660  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
23661  */
23662  __pyx_tuple__48 = PyTuple_Pack(61, __pyx_n_s_rho, __pyx_n_s_beta, __pyx_n_s_gravity, __pyx_n_s_alpha, __pyx_n_s_n, __pyx_n_s_thetaR, __pyx_n_s_thetaSR, __pyx_n_s_nSpace, __pyx_n_s_nElements_global, __pyx_n_s_nElementBoundaries_element, __pyx_n_s_elementNeighborsArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_elementMaterialTypes, __pyx_n_s_nDOF_trial_element, __pyx_n_s_u_l2g, __pyx_n_s_u_dof, __pyx_n_s_q_x, __pyx_n_s_q_u, __pyx_n_s_q_mass, __pyx_n_s_q_dmass, __pyx_n_s_q_r, __pyx_n_s_q_kr, __pyx_n_s_q_dkr, __pyx_n_s_q_kr_up, __pyx_n_s_q, __pyx_n_s_psiC, __pyx_n_s_pcBar, __pyx_n_s_pcBar_n, __pyx_n_s_pcBar_nM1, __pyx_n_s_pcBar_nM2, __pyx_n_s_onePlus_pcBar_n, __pyx_n_s_sBar, __pyx_n_s_sqrt_sBar, __pyx_n_s_DsBar_DpsiC, __pyx_n_s_thetaW, __pyx_n_s_DthetaW_DpsiC, __pyx_n_s_vBar, __pyx_n_s_vBar2, __pyx_n_s_DvBar_DpsiC, __pyx_n_s_KWr, __pyx_n_s_DKWr_DpsiC, __pyx_n_s_rho2, __pyx_n_s_thetaS, __pyx_n_s_rhom, __pyx_n_s_drhom, __pyx_n_s_m, __pyx_n_s_u_j, __pyx_n_s_u_eN, __pyx_n_s_u_neig, __pyx_n_s_kr_eN, __pyx_n_s_kr_neig, __pyx_n_s_phi_eN, __pyx_n_s_phi_neig, __pyx_n_s_eN, __pyx_n_s_eN_neighbor, __pyx_n_s_ebN, __pyx_n_s_ii, __pyx_n_s_I, __pyx_n_s_j, __pyx_n_s_matID, __pyx_n_s_nAvgWeight); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 359, __pyx_L1_error)
23663  __Pyx_GOTREF(__pyx_tuple__48);
23664  __Pyx_GIVEREF(__pyx_tuple__48);
23665  __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(24, 0, 61, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_RE_NCP1_evaluateElementCoefficie_2, 359, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 359, __pyx_L1_error)
23666 
23667  /* "subsurfaceTransportFunctions.pyx":486
23668  * #eN for upwind
23669  *
23670  * def RE_NCP1_getElementResidual(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
23671  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
23672  * numpy.ndarray[ITYPE_t,ndim=1] colind,
23673  */
23674  __pyx_tuple__50 = PyTuple_Pack(42, __pyx_n_s_gravity, __pyx_n_s_rowptr, __pyx_n_s_colind, __pyx_n_s_nSpace, __pyx_n_s_nElements_global, __pyx_n_s_nElementBoundaries_element, __pyx_n_s_elementNeighborsArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_nDOF_test_element, __pyx_n_s_q_u, __pyx_n_s_q_grad_u, __pyx_n_s_q_grad_w, __pyx_n_s_q_detJ, __pyx_n_s_q_m, __pyx_n_s_q_mt, __pyx_n_s_q_r, __pyx_n_s_q_kr, __pyx_n_s_q_kr_up, __pyx_n_s_q_flin, __pyx_n_s_q_alin, __pyx_n_s_elementResidual, __pyx_n_s_upwindFlag, __pyx_n_s_q, __pyx_n_s_nnz, __pyx_n_s_u_eN, __pyx_n_s_kr_eN, __pyx_n_s_phi_eN, __pyx_n_s_u_neig, __pyx_n_s_kr_neig, __pyx_n_s_phi_neig, __pyx_n_s_eN, __pyx_n_s_eN_neighbor, __pyx_n_s_ii, __pyx_n_s_I, __pyx_n_s_i, __pyx_n_s_ebN, __pyx_n_s_a_up, __pyx_n_s_f_up, __pyx_n_s_nAvgWeight, __pyx_n_s_weight, __pyx_n_s_volFactor, __pyx_n_s_volume); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 486, __pyx_L1_error)
23675  __Pyx_GOTREF(__pyx_tuple__50);
23676  __Pyx_GIVEREF(__pyx_tuple__50);
23677  __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(21, 0, 42, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_RE_NCP1_getElementResidual, 486, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 486, __pyx_L1_error)
23678 
23679  /* "subsurfaceTransportFunctions.pyx":574
23680  * #i
23681  * #eN
23682  * def RE_NCP1_getElementJacobian(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
23683  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
23684  * numpy.ndarray[ITYPE_t,ndim=1] colind,
23685  */
23686  __pyx_tuple__52 = PyTuple_Pack(51, __pyx_n_s_gravity, __pyx_n_s_rowptr, __pyx_n_s_colind, __pyx_n_s_nSpace, __pyx_n_s_nElements_global, __pyx_n_s_nElementBoundaries_element, __pyx_n_s_elementNeighborsArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_nDOF_test_element, __pyx_n_s_nDOF_trial_element, __pyx_n_s_q_u, __pyx_n_s_q_grad_u, __pyx_n_s_q_grad_w, __pyx_n_s_q_grad_v, __pyx_n_s_q_detJ, __pyx_n_s_q_m, __pyx_n_s_q_dm, __pyx_n_s_q_mt, __pyx_n_s_q_dmt, __pyx_n_s_q_r, __pyx_n_s_q_kr, __pyx_n_s_q_dkr, __pyx_n_s_q_kr_up, __pyx_n_s_q_flin, __pyx_n_s_q_alin, __pyx_n_s_elementJacobian, __pyx_n_s_upwindFlag, __pyx_n_s_picard, __pyx_n_s_q, __pyx_n_s_nnz, __pyx_n_s_u_eN, __pyx_n_s_kr_eN, __pyx_n_s_phi_eN, __pyx_n_s_u_neig, __pyx_n_s_kr_neig, __pyx_n_s_phi_neig, __pyx_n_s_dkr_up, __pyx_n_s_eN, __pyx_n_s_eN_neighbor, __pyx_n_s_ii, __pyx_n_s_I, __pyx_n_s_a_up, __pyx_n_s_f_up, __pyx_n_s_nAvgWeight, __pyx_n_s_weight, __pyx_n_s_volFactor, __pyx_n_s_thisElementIsUpwind, __pyx_n_s_volume, __pyx_n_s_i, __pyx_n_s_ebN, __pyx_n_s_j); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 574, __pyx_L1_error)
23687  __Pyx_GOTREF(__pyx_tuple__52);
23688  __Pyx_GIVEREF(__pyx_tuple__52);
23689  __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(26, 0, 51, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_RE_NCP1_getElementJacobian, 574, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 574, __pyx_L1_error)
23690 
23691  /* "subsurfaceTransportFunctions.pyx":673
23692  * ##################################################
23693  *
23694  * def updateMass_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] mt, # <<<<<<<<<<<<<<
23695  * numpy.ndarray[DTYPE_t,ndim=3] w,
23696  * numpy.ndarray[DTYPE_t,ndim=2] dV,
23697  */
23698  __pyx_tuple__54 = PyTuple_Pack(9, __pyx_n_s_mt, __pyx_n_s_w, __pyx_n_s_dV, __pyx_n_s_weak_residual, __pyx_n_s_eN, __pyx_n_s_i, __pyx_n_s_k, __pyx_n_s_mt_avg, __pyx_n_s_vol); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 673, __pyx_L1_error)
23699  __Pyx_GOTREF(__pyx_tuple__54);
23700  __Pyx_GIVEREF(__pyx_tuple__54);
23701  __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_updateMass_weakAvg, 673, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 673, __pyx_L1_error)
23702 
23703  /* "subsurfaceTransportFunctions.pyx":692
23704  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
23705  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
23706  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt, # <<<<<<<<<<<<<<
23707  * numpy.ndarray[DTYPE_t,ndim=3] w,
23708  * numpy.ndarray[DTYPE_t,ndim=3] v,
23709  */
23710  __pyx_tuple__56 = PyTuple_Pack(11, __pyx_n_s_dmt, __pyx_n_s_w, __pyx_n_s_v, __pyx_n_s_dV, __pyx_n_s_jacobian_weak_residual, __pyx_n_s_eN, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_dmtj_avg, __pyx_n_s_vol); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 692, __pyx_L1_error)
23711  __Pyx_GOTREF(__pyx_tuple__56);
23712  __Pyx_GIVEREF(__pyx_tuple__56);
23713  __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(5, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_updateMassJacobian_weakAvg, 692, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 692, __pyx_L1_error)
23714 
23715  /* "subsurfaceTransportFunctions.pyx":717
23716  * #ELLAM
23717  * ########################################################################
23718  * def calculateNormalFlux(numpy.ndarray[DTYPE_t,ndim=4] v, # <<<<<<<<<<<<<<
23719  * numpy.ndarray[DTYPE_t,ndim=4] n,
23720  * numpy.ndarray[DTYPE_t,ndim=3] dS,
23721  */
23722  __pyx_tuple__58 = PyTuple_Pack(9, __pyx_n_s_v, __pyx_n_s_n, __pyx_n_s_dS, __pyx_n_s_flux, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_kb, __pyx_n_s_integral, __pyx_n_s_I); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 717, __pyx_L1_error)
23723  __Pyx_GOTREF(__pyx_tuple__58);
23724  __Pyx_GIVEREF(__pyx_tuple__58);
23725  __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_calculateNormalFlux, 717, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 717, __pyx_L1_error)
23726 
23727  /* "subsurfaceTransportFunctions.pyx":732
23728  * flux[eN,ebN] = integral
23729  *
23730  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df, # <<<<<<<<<<<<<<
23731  * numpy.ndarray[DTYPE_t,ndim=3] characteristic_velocity,
23732  * numpy.ndarray[DTYPE_t,ndim=2] dm,
23733  */
23734  __pyx_tuple__60 = PyTuple_Pack(9, __pyx_n_s_df, __pyx_n_s_characteristic_velocity, __pyx_n_s_dm, __pyx_n_s_dV, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_I, __pyx_n_s_omega_e, __pyx_n_s_vol_e); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 732, __pyx_L1_error)
23735  __Pyx_GOTREF(__pyx_tuple__60);
23736  __Pyx_GIVEREF(__pyx_tuple__60);
23737  __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_computeSimpleCharacteristicVeloc, 732, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 732, __pyx_L1_error)
23738 
23739  /* "subsurfaceTransportFunctions.pyx":753
23740  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
23741  *
23742  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs, # <<<<<<<<<<<<<<
23743  * numpy.ndarray[DTYPE_t,ndim=1] characteristic_velocity_dofs,
23744  * numpy.ndarray[ITYPE_t,ndim=2] l2g,
23745  */
23746  __pyx_tuple__62 = PyTuple_Pack(11, __pyx_n_s_df_dofs, __pyx_n_s_characteristic_velocity_dofs, __pyx_n_s_l2g, __pyx_n_s_dm, __pyx_n_s_dV, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_j, __pyx_n_s_J, __pyx_n_s_omega_e, __pyx_n_s_vol_e); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 753, __pyx_L1_error)
23747  __Pyx_GOTREF(__pyx_tuple__62);
23748  __Pyx_GIVEREF(__pyx_tuple__62);
23749  __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(5, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_computeSimpleCharacteristicVeloc_2, 753, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(0, 753, __pyx_L1_error)
23750 
23751  /* "subsurfaceTransportFunctions.pyx":776
23752  *
23753  * #problem specific velocity evaluation
23754  * def rotatingGaussianElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
23755  * double t,
23756  * double tForReversal,
23757  */
23758  __pyx_tuple__64 = PyTuple_Pack(12, __pyx_n_s_transient, __pyx_n_s_t, __pyx_n_s_tForReversal, __pyx_n_s_clock, __pyx_n_s_xc, __pyx_n_s_yc, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_zvelocity, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(0, 776, __pyx_L1_error)
23759  __Pyx_GOTREF(__pyx_tuple__64);
23760  __Pyx_GIVEREF(__pyx_tuple__64);
23761  __pyx_codeobj__65 = (PyObject*)__Pyx_PyCode_New(9, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__64, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_rotatingGaussianElementVelocityE, 776, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__65)) __PYX_ERR(0, 776, __pyx_L1_error)
23762 
23763  /* "subsurfaceTransportFunctions.pyx":816
23764  *
23765  *
23766  * def rotatingGaussianElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
23767  * double t,
23768  * double tForReversal,
23769  */
23770  __pyx_tuple__66 = PyTuple_Pack(13, __pyx_n_s_transient, __pyx_n_s_t, __pyx_n_s_tForReversal, __pyx_n_s_clock, __pyx_n_s_xc, __pyx_n_s_yc, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_zvelocity, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_k, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(0, 816, __pyx_L1_error)
23771  __Pyx_GOTREF(__pyx_tuple__66);
23772  __Pyx_GIVEREF(__pyx_tuple__66);
23773  __pyx_codeobj__67 = (PyObject*)__Pyx_PyCode_New(9, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_rotatingGaussianElementVelocityE_2, 816, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__67)) __PYX_ERR(0, 816, __pyx_L1_error)
23774 
23775  /* "subsurfaceTransportFunctions.pyx":859
23776  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
23777  *
23778  * def helicalElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
23779  * double t,
23780  * double tForReversal,
23781  */
23782  __pyx_tuple__68 = PyTuple_Pack(12, __pyx_n_s_transient, __pyx_n_s_t, __pyx_n_s_tForReversal, __pyx_n_s_clock, __pyx_n_s_zVelocity, __pyx_n_s_xc, __pyx_n_s_yc, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(0, 859, __pyx_L1_error)
23783  __Pyx_GOTREF(__pyx_tuple__68);
23784  __Pyx_GIVEREF(__pyx_tuple__68);
23785  __pyx_codeobj__69 = (PyObject*)__Pyx_PyCode_New(9, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_helicalElementVelocityEval3, 859, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__69)) __PYX_ERR(0, 859, __pyx_L1_error)
23786 
23787  /* "subsurfaceTransportFunctions.pyx":884
23788  * v[eN,k,2]=zVelocity
23789  *
23790  * def helicalElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
23791  * double t,
23792  * double tForReversal,
23793  */
23794  __pyx_tuple__70 = PyTuple_Pack(13, __pyx_n_s_transient, __pyx_n_s_t, __pyx_n_s_tForReversal, __pyx_n_s_clock, __pyx_n_s_zVelocity, __pyx_n_s_xc, __pyx_n_s_yc, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_k, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__70)) __PYX_ERR(0, 884, __pyx_L1_error)
23795  __Pyx_GOTREF(__pyx_tuple__70);
23796  __Pyx_GIVEREF(__pyx_tuple__70);
23797  __pyx_codeobj__71 = (PyObject*)__Pyx_PyCode_New(9, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__70, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_helicalElementVelocityEval4, 884, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__71)) __PYX_ERR(0, 884, __pyx_L1_error)
23798 
23799  /* "subsurfaceTransportFunctions.pyx":911
23800  * v[eN,ebN,k,2]=zVelocity
23801  *
23802  * def vortexElementVelocityEval3(double t, # <<<<<<<<<<<<<<
23803  * numpy.ndarray[DTYPE_t,ndim=3] x,
23804  * numpy.ndarray[DTYPE_t,ndim=3] v):
23805  */
23806  __pyx_tuple__72 = PyTuple_Pack(7, __pyx_n_s_t, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_pi, __pyx_n_s_one8); if (unlikely(!__pyx_tuple__72)) __PYX_ERR(0, 911, __pyx_L1_error)
23807  __Pyx_GOTREF(__pyx_tuple__72);
23808  __Pyx_GIVEREF(__pyx_tuple__72);
23809  __pyx_codeobj__73 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__72, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_vortexElementVelocityEval3, 911, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__73)) __PYX_ERR(0, 911, __pyx_L1_error)
23810 
23811  /* "subsurfaceTransportFunctions.pyx":924
23812  *
23813  *
23814  * def vortexElementVelocityEval4(double t, # <<<<<<<<<<<<<<
23815  * numpy.ndarray[DTYPE_t,ndim=4] x,
23816  * numpy.ndarray[DTYPE_t,ndim=4] v):
23817  */
23818  __pyx_tuple__74 = PyTuple_Pack(8, __pyx_n_s_t, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_ebN, __pyx_n_s_pi, __pyx_n_s_one8); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(0, 924, __pyx_L1_error)
23819  __Pyx_GOTREF(__pyx_tuple__74);
23820  __Pyx_GIVEREF(__pyx_tuple__74);
23821  __pyx_codeobj__75 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__74, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_cekees_proteus_proteus_sub, __pyx_n_s_vortexElementVelocityEval4, 924, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__75)) __PYX_ERR(0, 924, __pyx_L1_error)
23822  __Pyx_RefNannyFinishContext();
23823  return 0;
23824  __pyx_L1_error:;
23825  __Pyx_RefNannyFinishContext();
23826  return -1;
23827 }
23828 
23829 static int __Pyx_InitGlobals(void) {
23830  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
23831  __pyx_float_0_0 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_float_0_0)) __PYX_ERR(0, 1, __pyx_L1_error)
23832  __pyx_float_0_5 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_float_0_5)) __PYX_ERR(0, 1, __pyx_L1_error)
23833  __pyx_float_2_0 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_float_2_0)) __PYX_ERR(0, 1, __pyx_L1_error)
23834  __pyx_float_1_0eneg_20 = PyFloat_FromDouble(1.0e-20); if (unlikely(!__pyx_float_1_0eneg_20)) __PYX_ERR(0, 1, __pyx_L1_error)
23835  return 0;
23836  __pyx_L1_error:;
23837  return -1;
23838 }
23839 
23840 #if PY_MAJOR_VERSION < 3
23841 PyMODINIT_FUNC initsubsurfaceTransportFunctions(void); /*proto*/
23842 PyMODINIT_FUNC initsubsurfaceTransportFunctions(void)
23843 #else
23844 PyMODINIT_FUNC PyInit_subsurfaceTransportFunctions(void); /*proto*/
23845 PyMODINIT_FUNC PyInit_subsurfaceTransportFunctions(void)
23846 #endif
23847 {
23848  PyObject *__pyx_t_1 = NULL;
23849  __Pyx_RefNannyDeclarations
23850  #if CYTHON_REFNANNY
23851  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
23852  if (!__Pyx_RefNanny) {
23853  PyErr_Clear();
23854  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
23855  if (!__Pyx_RefNanny)
23856  Py_FatalError("failed to import 'refnanny' module");
23857  }
23858  #endif
23859  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_subsurfaceTransportFunctions(void)", 0);
23860  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23861  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
23862  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
23863  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
23864  #ifdef __Pyx_CyFunction_USED
23865  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23866  #endif
23867  #ifdef __Pyx_FusedFunction_USED
23868  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23869  #endif
23870  #ifdef __Pyx_Coroutine_USED
23871  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23872  #endif
23873  #ifdef __Pyx_Generator_USED
23874  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23875  #endif
23876  #ifdef __Pyx_StopAsyncIteration_USED
23877  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23878  #endif
23879  /*--- Library function declarations ---*/
23880  /*--- Threads initialization code ---*/
23881  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
23882  #ifdef WITH_THREAD /* Python build with threading support? */
23883  PyEval_InitThreads();
23884  #endif
23885  #endif
23886  /*--- Module creation code ---*/
23887  #if PY_MAJOR_VERSION < 3
23888  __pyx_m = Py_InitModule4("subsurfaceTransportFunctions", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
23889  #else
23890  __pyx_m = PyModule_Create(&__pyx_moduledef);
23891  #endif
23892  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
23893  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
23894  Py_INCREF(__pyx_d);
23895  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
23896  #if CYTHON_COMPILING_IN_PYPY
23897  Py_INCREF(__pyx_b);
23898  #endif
23899  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
23900  /*--- Initialize various global constants etc. ---*/
23901  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23902  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
23903  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23904  #endif
23905  if (__pyx_module_is_main_subsurfaceTransportFunctions) {
23906  if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23907  }
23908  #if PY_MAJOR_VERSION >= 3
23909  {
23910  PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
23911  if (!PyDict_GetItemString(modules, "subsurfaceTransportFunctions")) {
23912  if (unlikely(PyDict_SetItemString(modules, "subsurfaceTransportFunctions", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
23913  }
23914  }
23915  #endif
23916  /*--- Builtin init code ---*/
23917  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23918  /*--- Constants init code ---*/
23919  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23920  /*--- Global init code ---*/
23921  /*--- Variable export code ---*/
23922  /*--- Function export code ---*/
23923  /*--- Type init code ---*/
23924  /*--- Type import code ---*/
23925  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type",
23926  #if CYTHON_COMPILING_IN_PYPY
23927  sizeof(PyTypeObject),
23928  #else
23929  sizeof(PyHeapTypeObject),
23930  #endif
23931  0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(2, 9, __pyx_L1_error)
23932  __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) __PYX_ERR(1, 155, __pyx_L1_error)
23933  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) __PYX_ERR(1, 168, __pyx_L1_error)
23934  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) __PYX_ERR(1, 172, __pyx_L1_error)
23935  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) __PYX_ERR(1, 181, __pyx_L1_error)
23936  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) __PYX_ERR(1, 861, __pyx_L1_error)
23937  /*--- Variable import code ---*/
23938  /*--- Function import code ---*/
23939  /*--- Execution code ---*/
23940  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
23941  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23942  #endif
23943 
23944  /* "subsurfaceTransportFunctions.pyx":1
23945  * import numpy # <<<<<<<<<<<<<<
23946  * cimport numpy
23947  * cdef extern from "math.h":
23948  */
23949  __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
23950  __Pyx_GOTREF(__pyx_t_1);
23951  if (PyDict_SetItem(__pyx_d, __pyx_n_s_numpy, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23952  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23953 
23954  /* "subsurfaceTransportFunctions.pyx":18
23955  * ctypedef int ITYPE_t
23956  *
23957  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global, # <<<<<<<<<<<<<<
23958  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundariesArray,
23959  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
23960  */
23961  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
23962  __Pyx_GOTREF(__pyx_t_1);
23963  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setExteriorElementBoundaryTypes, __pyx_t_1) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
23964  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23965 
23966  /* "subsurfaceTransportFunctions.pyx":29
23967  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
23968  *
23969  * def setElementBoundariesArray(int nElementBoundaries_global, # <<<<<<<<<<<<<<
23970  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
23971  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
23972  */
23973  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_3setElementBoundariesArray, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
23974  __Pyx_GOTREF(__pyx_t_1);
23975  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setElementBoundariesArray, __pyx_t_1) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
23976  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23977 
23978  /* "subsurfaceTransportFunctions.pyx":43
23979  *
23980  * ###
23981  * def setScalarMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
23982  * numpy.ndarray[DTYPE_t,ndim=2] q_vals,
23983  * dict material_functions):
23984  */
23985  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error)
23986  __Pyx_GOTREF(__pyx_t_1);
23987  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setScalarMaterialFunctionOverEle, __pyx_t_1) < 0) __PYX_ERR(0, 43, __pyx_L1_error)
23988  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23989 
23990  /* "subsurfaceTransportFunctions.pyx":56
23991  * q_vals[eN,k] = material_functions[material]
23992  *
23993  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
23994  * numpy.ndarray[DTYPE_t,ndim=3] q_vals,
23995  * dict material_functions):
23996  */
23997  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error)
23998  __Pyx_GOTREF(__pyx_t_1);
23999  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setVectorMaterialFunctionOverEle, __pyx_t_1) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
24000  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24001 
24002  /* "subsurfaceTransportFunctions.pyx":69
24003  *
24004  *
24005  * def setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
24006  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24007  * numpy.ndarray[DTYPE_t,ndim=3] ebq_vals,
24008  */
24009  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error)
24010  __Pyx_GOTREF(__pyx_t_1);
24011  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setScalarMaterialFunctionOverEle_2, __pyx_t_1) < 0) __PYX_ERR(0, 69, __pyx_L1_error)
24012  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24013 
24014  /* "subsurfaceTransportFunctions.pyx":91
24015  * material_functions[material_right])
24016  *
24017  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
24018  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24019  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24020  */
24021  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error)
24022  __Pyx_GOTREF(__pyx_t_1);
24023  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setSparseTensorMaterialFunctionO, __pyx_t_1) < 0) __PYX_ERR(0, 91, __pyx_L1_error)
24024  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24025 
24026  /* "subsurfaceTransportFunctions.pyx":118
24027  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
24028  *
24029  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
24030  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24031  * numpy.ndarray[DTYPE_t,ndim=2] ebq_global_vals,
24032  */
24033  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error)
24034  __Pyx_GOTREF(__pyx_t_1);
24035  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setScalarMaterialFunctionOverGlo, __pyx_t_1) < 0) __PYX_ERR(0, 118, __pyx_L1_error)
24036  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24037 
24038  /* "subsurfaceTransportFunctions.pyx":139
24039  *
24040  *
24041  * def setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
24042  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24043  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24044  */
24045  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error)
24046  __Pyx_GOTREF(__pyx_t_1);
24047  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setSparseTensorMaterialFunctionO_2, __pyx_t_1) < 0) __PYX_ERR(0, 139, __pyx_L1_error)
24048  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24049 
24050  /* "subsurfaceTransportFunctions.pyx":165
24051  *
24052  * ###
24053  * def evaluateScalarMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
24054  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
24055  * numpy.ndarray[DTYPE_t,ndim=3] x,
24056  */
24057  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error)
24058  __Pyx_GOTREF(__pyx_t_1);
24059  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateScalarMaterialFunctionOv, __pyx_t_1) < 0) __PYX_ERR(0, 165, __pyx_L1_error)
24060  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24061 
24062  /* "subsurfaceTransportFunctions.pyx":180
24063  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
24064  *
24065  * def evaluateVectorMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
24066  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
24067  * numpy.ndarray[DTYPE_t,ndim=3] x,
24068  */
24069  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
24070  __Pyx_GOTREF(__pyx_t_1);
24071  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateVectorMaterialFunctionOv, __pyx_t_1) < 0) __PYX_ERR(0, 180, __pyx_L1_error)
24072  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24073 
24074  /* "subsurfaceTransportFunctions.pyx":195
24075  *
24076  *
24077  * def evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
24078  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24079  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24080  */
24081  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 195, __pyx_L1_error)
24082  __Pyx_GOTREF(__pyx_t_1);
24083  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateScalarMaterialFunctionOv_2, __pyx_t_1) < 0) __PYX_ERR(0, 195, __pyx_L1_error)
24084  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24085 
24086  /* "subsurfaceTransportFunctions.pyx":219
24087  * material_functions[material_right](x[eN,ebN_local,k],t))
24088  *
24089  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
24090  * double t,
24091  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24092  */
24093  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error)
24094  __Pyx_GOTREF(__pyx_t_1);
24095  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateSparseTensorMaterialFunc, __pyx_t_1) < 0) __PYX_ERR(0, 219, __pyx_L1_error)
24096  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24097 
24098  /* "subsurfaceTransportFunctions.pyx":248
24099  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
24100  *
24101  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
24102  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24103  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
24104  */
24105  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error)
24106  __Pyx_GOTREF(__pyx_t_1);
24107  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateScalarMaterialFunctionOv_3, __pyx_t_1) < 0) __PYX_ERR(0, 248, __pyx_L1_error)
24108  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24109 
24110  /* "subsurfaceTransportFunctions.pyx":271
24111  *
24112  *
24113  * def evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
24114  * double t,
24115  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
24116  */
24117  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 271, __pyx_L1_error)
24118  __Pyx_GOTREF(__pyx_t_1);
24119  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateSparseTensorMaterialFunc_2, __pyx_t_1) < 0) __PYX_ERR(0, 271, __pyx_L1_error)
24120  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24121 
24122  /* "subsurfaceTransportFunctions.pyx":301
24123  *
24124  * ##################################################
24125  * def RE_NCP1_evaluateElementCoefficients_Linear(double rho, # <<<<<<<<<<<<<<
24126  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
24127  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
24128  */
24129  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error)
24130  __Pyx_GOTREF(__pyx_t_1);
24131  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_NCP1_evaluateElementCoefficie, __pyx_t_1) < 0) __PYX_ERR(0, 301, __pyx_L1_error)
24132  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24133 
24134  /* "subsurfaceTransportFunctions.pyx":359
24135  *
24136  *
24137  * def RE_NCP1_evaluateElementCoefficients_VGM(double rho, # <<<<<<<<<<<<<<
24138  * double beta,
24139  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
24140  */
24141  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 359, __pyx_L1_error)
24142  __Pyx_GOTREF(__pyx_t_1);
24143  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_NCP1_evaluateElementCoefficie_2, __pyx_t_1) < 0) __PYX_ERR(0, 359, __pyx_L1_error)
24144  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24145 
24146  /* "subsurfaceTransportFunctions.pyx":486
24147  * #eN for upwind
24148  *
24149  * def RE_NCP1_getElementResidual(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
24150  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
24151  * numpy.ndarray[ITYPE_t,ndim=1] colind,
24152  */
24153  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error)
24154  __Pyx_GOTREF(__pyx_t_1);
24155  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_NCP1_getElementResidual, __pyx_t_1) < 0) __PYX_ERR(0, 486, __pyx_L1_error)
24156  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24157 
24158  /* "subsurfaceTransportFunctions.pyx":574
24159  * #i
24160  * #eN
24161  * def RE_NCP1_getElementJacobian(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
24162  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
24163  * numpy.ndarray[ITYPE_t,ndim=1] colind,
24164  */
24165  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 574, __pyx_L1_error)
24166  __Pyx_GOTREF(__pyx_t_1);
24167  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_NCP1_getElementJacobian, __pyx_t_1) < 0) __PYX_ERR(0, 574, __pyx_L1_error)
24168  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24169 
24170  /* "subsurfaceTransportFunctions.pyx":673
24171  * ##################################################
24172  *
24173  * def updateMass_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] mt, # <<<<<<<<<<<<<<
24174  * numpy.ndarray[DTYPE_t,ndim=3] w,
24175  * numpy.ndarray[DTYPE_t,ndim=2] dV,
24176  */
24177  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_37updateMass_weakAvg, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 673, __pyx_L1_error)
24178  __Pyx_GOTREF(__pyx_t_1);
24179  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateMass_weakAvg, __pyx_t_1) < 0) __PYX_ERR(0, 673, __pyx_L1_error)
24180  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24181 
24182  /* "subsurfaceTransportFunctions.pyx":692
24183  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
24184  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
24185  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt, # <<<<<<<<<<<<<<
24186  * numpy.ndarray[DTYPE_t,ndim=3] w,
24187  * numpy.ndarray[DTYPE_t,ndim=3] v,
24188  */
24189  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 692, __pyx_L1_error)
24190  __Pyx_GOTREF(__pyx_t_1);
24191  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateMassJacobian_weakAvg, __pyx_t_1) < 0) __PYX_ERR(0, 692, __pyx_L1_error)
24192  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24193 
24194  /* "subsurfaceTransportFunctions.pyx":717
24195  * #ELLAM
24196  * ########################################################################
24197  * def calculateNormalFlux(numpy.ndarray[DTYPE_t,ndim=4] v, # <<<<<<<<<<<<<<
24198  * numpy.ndarray[DTYPE_t,ndim=4] n,
24199  * numpy.ndarray[DTYPE_t,ndim=3] dS,
24200  */
24201  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_41calculateNormalFlux, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 717, __pyx_L1_error)
24202  __Pyx_GOTREF(__pyx_t_1);
24203  if (PyDict_SetItem(__pyx_d, __pyx_n_s_calculateNormalFlux, __pyx_t_1) < 0) __PYX_ERR(0, 717, __pyx_L1_error)
24204  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24205 
24206  /* "subsurfaceTransportFunctions.pyx":732
24207  * flux[eN,ebN] = integral
24208  *
24209  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df, # <<<<<<<<<<<<<<
24210  * numpy.ndarray[DTYPE_t,ndim=3] characteristic_velocity,
24211  * numpy.ndarray[DTYPE_t,ndim=2] dm,
24212  */
24213  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 732, __pyx_L1_error)
24214  __Pyx_GOTREF(__pyx_t_1);
24215  if (PyDict_SetItem(__pyx_d, __pyx_n_s_computeSimpleCharacteristicVeloc, __pyx_t_1) < 0) __PYX_ERR(0, 732, __pyx_L1_error)
24216  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24217 
24218  /* "subsurfaceTransportFunctions.pyx":753
24219  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
24220  *
24221  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs, # <<<<<<<<<<<<<<
24222  * numpy.ndarray[DTYPE_t,ndim=1] characteristic_velocity_dofs,
24223  * numpy.ndarray[ITYPE_t,ndim=2] l2g,
24224  */
24225  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 753, __pyx_L1_error)
24226  __Pyx_GOTREF(__pyx_t_1);
24227  if (PyDict_SetItem(__pyx_d, __pyx_n_s_computeSimpleCharacteristicVeloc_2, __pyx_t_1) < 0) __PYX_ERR(0, 753, __pyx_L1_error)
24228  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24229 
24230  /* "subsurfaceTransportFunctions.pyx":776
24231  *
24232  * #problem specific velocity evaluation
24233  * def rotatingGaussianElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
24234  * double t,
24235  * double tForReversal,
24236  */
24237  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 776, __pyx_L1_error)
24238  __Pyx_GOTREF(__pyx_t_1);
24239  if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotatingGaussianElementVelocityE, __pyx_t_1) < 0) __PYX_ERR(0, 776, __pyx_L1_error)
24240  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24241 
24242  /* "subsurfaceTransportFunctions.pyx":816
24243  *
24244  *
24245  * def rotatingGaussianElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
24246  * double t,
24247  * double tForReversal,
24248  */
24249  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 816, __pyx_L1_error)
24250  __Pyx_GOTREF(__pyx_t_1);
24251  if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotatingGaussianElementVelocityE_2, __pyx_t_1) < 0) __PYX_ERR(0, 816, __pyx_L1_error)
24252  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24253 
24254  /* "subsurfaceTransportFunctions.pyx":859
24255  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
24256  *
24257  * def helicalElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
24258  * double t,
24259  * double tForReversal,
24260  */
24261  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_51helicalElementVelocityEval3, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 859, __pyx_L1_error)
24262  __Pyx_GOTREF(__pyx_t_1);
24263  if (PyDict_SetItem(__pyx_d, __pyx_n_s_helicalElementVelocityEval3, __pyx_t_1) < 0) __PYX_ERR(0, 859, __pyx_L1_error)
24264  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24265 
24266  /* "subsurfaceTransportFunctions.pyx":884
24267  * v[eN,k,2]=zVelocity
24268  *
24269  * def helicalElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
24270  * double t,
24271  * double tForReversal,
24272  */
24273  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_53helicalElementVelocityEval4, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 884, __pyx_L1_error)
24274  __Pyx_GOTREF(__pyx_t_1);
24275  if (PyDict_SetItem(__pyx_d, __pyx_n_s_helicalElementVelocityEval4, __pyx_t_1) < 0) __PYX_ERR(0, 884, __pyx_L1_error)
24276  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24277 
24278  /* "subsurfaceTransportFunctions.pyx":911
24279  * v[eN,ebN,k,2]=zVelocity
24280  *
24281  * def vortexElementVelocityEval3(double t, # <<<<<<<<<<<<<<
24282  * numpy.ndarray[DTYPE_t,ndim=3] x,
24283  * numpy.ndarray[DTYPE_t,ndim=3] v):
24284  */
24285  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_55vortexElementVelocityEval3, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 911, __pyx_L1_error)
24286  __Pyx_GOTREF(__pyx_t_1);
24287  if (PyDict_SetItem(__pyx_d, __pyx_n_s_vortexElementVelocityEval3, __pyx_t_1) < 0) __PYX_ERR(0, 911, __pyx_L1_error)
24288  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24289 
24290  /* "subsurfaceTransportFunctions.pyx":924
24291  *
24292  *
24293  * def vortexElementVelocityEval4(double t, # <<<<<<<<<<<<<<
24294  * numpy.ndarray[DTYPE_t,ndim=4] x,
24295  * numpy.ndarray[DTYPE_t,ndim=4] v):
24296  */
24297  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_57vortexElementVelocityEval4, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 924, __pyx_L1_error)
24298  __Pyx_GOTREF(__pyx_t_1);
24299  if (PyDict_SetItem(__pyx_d, __pyx_n_s_vortexElementVelocityEval4, __pyx_t_1) < 0) __PYX_ERR(0, 924, __pyx_L1_error)
24300  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24301 
24302  /* "subsurfaceTransportFunctions.pyx":1
24303  * import numpy # <<<<<<<<<<<<<<
24304  * cimport numpy
24305  * cdef extern from "math.h":
24306  */
24307  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
24308  __Pyx_GOTREF(__pyx_t_1);
24309  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
24310  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24311 
24312  /* "linux2/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":997
24313  * raise ImportError("numpy.core.umath failed to import")
24314  *
24315  * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
24316  * try:
24317  * _import_umath()
24318  */
24319 
24320  /*--- Wrapped vars code ---*/
24321 
24322  goto __pyx_L0;
24323  __pyx_L1_error:;
24324  __Pyx_XDECREF(__pyx_t_1);
24325  if (__pyx_m) {
24326  if (__pyx_d) {
24327  __Pyx_AddTraceback("init subsurfaceTransportFunctions", __pyx_clineno, __pyx_lineno, __pyx_filename);
24328  }
24329  Py_DECREF(__pyx_m); __pyx_m = 0;
24330  } else if (!PyErr_Occurred()) {
24331  PyErr_SetString(PyExc_ImportError, "init subsurfaceTransportFunctions");
24332  }
24333  __pyx_L0:;
24334  __Pyx_RefNannyFinishContext();
24335  #if PY_MAJOR_VERSION < 3
24336  return;
24337  #else
24338  return __pyx_m;
24339  #endif
24340 }
24341 
24342 /* --- Runtime support code --- */
24343 /* Refnanny */
24344 #if CYTHON_REFNANNY
24345 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
24346  PyObject *m = NULL, *p = NULL;
24347  void *r = NULL;
24348  m = PyImport_ImportModule((char *)modname);
24349  if (!m) goto end;
24350  p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
24351  if (!p) goto end;
24352  r = PyLong_AsVoidPtr(p);
24353 end:
24354  Py_XDECREF(p);
24355  Py_XDECREF(m);
24356  return (__Pyx_RefNannyAPIStruct *)r;
24357 }
24358 #endif
24359 
24360 /* GetBuiltinName */
24361 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
24362  PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
24363  if (unlikely(!result)) {
24364  PyErr_Format(PyExc_NameError,
24365 #if PY_MAJOR_VERSION >= 3
24366  "name '%U' is not defined", name);
24367 #else
24368  "name '%.200s' is not defined", PyString_AS_STRING(name));
24369 #endif
24370  }
24371  return result;
24372 }
24373 
24374 /* RaiseArgTupleInvalid */
24375 static void __Pyx_RaiseArgtupleInvalid(
24376  const char* func_name,
24377  int exact,
24378  Py_ssize_t num_min,
24379  Py_ssize_t num_max,
24380  Py_ssize_t num_found)
24381 {
24382  Py_ssize_t num_expected;
24383  const char *more_or_less;
24384  if (num_found < num_min) {
24385  num_expected = num_min;
24386  more_or_less = "at least";
24387  } else {
24388  num_expected = num_max;
24389  more_or_less = "at most";
24390  }
24391  if (exact) {
24392  more_or_less = "exactly";
24393  }
24394  PyErr_Format(PyExc_TypeError,
24395  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
24396  func_name, more_or_less, num_expected,
24397  (num_expected == 1) ? "" : "s", num_found);
24398 }
24399 
24400 /* RaiseDoubleKeywords */
24401 static void __Pyx_RaiseDoubleKeywordsError(
24402  const char* func_name,
24403  PyObject* kw_name)
24404 {
24405  PyErr_Format(PyExc_TypeError,
24406  #if PY_MAJOR_VERSION >= 3
24407  "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
24408  #else
24409  "%s() got multiple values for keyword argument '%s'", func_name,
24410  PyString_AsString(kw_name));
24411  #endif
24412 }
24413 
24414 /* ParseKeywords */
24415 static int __Pyx_ParseOptionalKeywords(
24416  PyObject *kwds,
24417  PyObject **argnames[],
24418  PyObject *kwds2,
24419  PyObject *values[],
24420  Py_ssize_t num_pos_args,
24421  const char* function_name)
24422 {
24423  PyObject *key = 0, *value = 0;
24424  Py_ssize_t pos = 0;
24425  PyObject*** name;
24426  PyObject*** first_kw_arg = argnames + num_pos_args;
24427  while (PyDict_Next(kwds, &pos, &key, &value)) {
24428  name = first_kw_arg;
24429  while (*name && (**name != key)) name++;
24430  if (*name) {
24431  values[name-argnames] = value;
24432  continue;
24433  }
24434  name = first_kw_arg;
24435  #if PY_MAJOR_VERSION < 3
24436  if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
24437  while (*name) {
24438  if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
24439  && _PyString_Eq(**name, key)) {
24440  values[name-argnames] = value;
24441  break;
24442  }
24443  name++;
24444  }
24445  if (*name) continue;
24446  else {
24447  PyObject*** argname = argnames;
24448  while (argname != first_kw_arg) {
24449  if ((**argname == key) || (
24450  (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
24451  && _PyString_Eq(**argname, key))) {
24452  goto arg_passed_twice;
24453  }
24454  argname++;
24455  }
24456  }
24457  } else
24458  #endif
24459  if (likely(PyUnicode_Check(key))) {
24460  while (*name) {
24461  int cmp = (**name == key) ? 0 :
24462  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
24463  (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
24464  #endif
24465  PyUnicode_Compare(**name, key);
24466  if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
24467  if (cmp == 0) {
24468  values[name-argnames] = value;
24469  break;
24470  }
24471  name++;
24472  }
24473  if (*name) continue;
24474  else {
24475  PyObject*** argname = argnames;
24476  while (argname != first_kw_arg) {
24477  int cmp = (**argname == key) ? 0 :
24478  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
24479  (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
24480  #endif
24481  PyUnicode_Compare(**argname, key);
24482  if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
24483  if (cmp == 0) goto arg_passed_twice;
24484  argname++;
24485  }
24486  }
24487  } else
24488  goto invalid_keyword_type;
24489  if (kwds2) {
24490  if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
24491  } else {
24492  goto invalid_keyword;
24493  }
24494  }
24495  return 0;
24496 arg_passed_twice:
24497  __Pyx_RaiseDoubleKeywordsError(function_name, key);
24498  goto bad;
24499 invalid_keyword_type:
24500  PyErr_Format(PyExc_TypeError,
24501  "%.200s() keywords must be strings", function_name);
24502  goto bad;
24503 invalid_keyword:
24504  PyErr_Format(PyExc_TypeError,
24505  #if PY_MAJOR_VERSION < 3
24506  "%.200s() got an unexpected keyword argument '%.200s'",
24507  function_name, PyString_AsString(key));
24508  #else
24509  "%s() got an unexpected keyword argument '%U'",
24510  function_name, key);
24511  #endif
24512 bad:
24513  return -1;
24514 }
24515 
24516 /* ArgTypeTest */
24517 static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
24518  PyErr_Format(PyExc_TypeError,
24519  "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
24520  name, type->tp_name, Py_TYPE(obj)->tp_name);
24521 }
24522 static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
24523  const char *name, int exact)
24524 {
24525  if (unlikely(!type)) {
24526  PyErr_SetString(PyExc_SystemError, "Missing type object");
24527  return 0;
24528  }
24529  if (none_allowed && obj == Py_None) return 1;
24530  else if (exact) {
24531  if (likely(Py_TYPE(obj) == type)) return 1;
24532  #if PY_MAJOR_VERSION == 2
24533  else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
24534  #endif
24535  }
24536  else {
24537  if (likely(PyObject_TypeCheck(obj, type))) return 1;
24538  }
24539  __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
24540  return 0;
24541 }
24542 
24543 /* BufferFormatCheck */
24544 static CYTHON_INLINE int __Pyx_IsLittleEndian(void) {
24545  unsigned int n = 1;
24546  return *(unsigned char*)(&n) != 0;
24547 }
24548 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
24549  __Pyx_BufFmt_StackElem* stack,
24550  __Pyx_TypeInfo* type) {
24551  stack[0].field = &ctx->root;
24552  stack[0].parent_offset = 0;
24553  ctx->root.type = type;
24554  ctx->root.name = "buffer dtype";
24555  ctx->root.offset = 0;
24556  ctx->head = stack;
24557  ctx->head->field = &ctx->root;
24558  ctx->fmt_offset = 0;
24559  ctx->head->parent_offset = 0;
24560  ctx->new_packmode = '@';
24561  ctx->enc_packmode = '@';
24562  ctx->new_count = 1;
24563  ctx->enc_count = 0;
24564  ctx->enc_type = 0;
24565  ctx->is_complex = 0;
24566  ctx->is_valid_array = 0;
24567  ctx->struct_alignment = 0;
24568  while (type->typegroup == 'S') {
24569  ++ctx->head;
24570  ctx->head->field = type->fields;
24571  ctx->head->parent_offset = 0;
24572  type = type->fields->type;
24573  }
24574 }
24575 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
24576  int count;
24577  const char* t = *ts;
24578  if (*t < '0' || *t > '9') {
24579  return -1;
24580  } else {
24581  count = *t++ - '0';
24582  while (*t >= '0' && *t < '9') {
24583  count *= 10;
24584  count += *t++ - '0';
24585  }
24586  }
24587  *ts = t;
24588  return count;
24589 }
24590 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
24591  int number = __Pyx_BufFmt_ParseNumber(ts);
24592  if (number == -1)
24593  PyErr_Format(PyExc_ValueError,\
24594  "Does not understand character buffer dtype format string ('%c')", **ts);
24595  return number;
24596 }
24597 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
24598  PyErr_Format(PyExc_ValueError,
24599  "Unexpected format string character: '%c'", ch);
24600 }
24601 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
24602  switch (ch) {
24603  case 'c': return "'char'";
24604  case 'b': return "'signed char'";
24605  case 'B': return "'unsigned char'";
24606  case 'h': return "'short'";
24607  case 'H': return "'unsigned short'";
24608  case 'i': return "'int'";
24609  case 'I': return "'unsigned int'";
24610  case 'l': return "'long'";
24611  case 'L': return "'unsigned long'";
24612  case 'q': return "'long long'";
24613  case 'Q': return "'unsigned long long'";
24614  case 'f': return (is_complex ? "'complex float'" : "'float'");
24615  case 'd': return (is_complex ? "'complex double'" : "'double'");
24616  case 'g': return (is_complex ? "'complex long double'" : "'long double'");
24617  case 'T': return "a struct";
24618  case 'O': return "Python object";
24619  case 'P': return "a pointer";
24620  case 's': case 'p': return "a string";
24621  case 0: return "end";
24622  default: return "unparseable format string";
24623  }
24624 }
24625 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
24626  switch (ch) {
24627  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
24628  case 'h': case 'H': return 2;
24629  case 'i': case 'I': case 'l': case 'L': return 4;
24630  case 'q': case 'Q': return 8;
24631  case 'f': return (is_complex ? 8 : 4);
24632  case 'd': return (is_complex ? 16 : 8);
24633  case 'g': {
24634  PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
24635  return 0;
24636  }
24637  case 'O': case 'P': return sizeof(void*);
24638  default:
24639  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
24640  return 0;
24641  }
24642 }
24643 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
24644  switch (ch) {
24645  case 'c': case 'b': case 'B': case 's': case 'p': return 1;
24646  case 'h': case 'H': return sizeof(short);
24647  case 'i': case 'I': return sizeof(int);
24648  case 'l': case 'L': return sizeof(long);
24649  #ifdef HAVE_LONG_LONG
24650  case 'q': case 'Q': return sizeof(PY_LONG_LONG);
24651  #endif
24652  case 'f': return sizeof(float) * (is_complex ? 2 : 1);
24653  case 'd': return sizeof(double) * (is_complex ? 2 : 1);
24654  case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
24655  case 'O': case 'P': return sizeof(void*);
24656  default: {
24657  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
24658  return 0;
24659  }
24660  }
24661 }
24662 typedef struct { char c; short x; } __Pyx_st_short;
24663 typedef struct { char c; int x; } __Pyx_st_int;
24664 typedef struct { char c; long x; } __Pyx_st_long;
24665 typedef struct { char c; float x; } __Pyx_st_float;
24666 typedef struct { char c; double x; } __Pyx_st_double;
24667 typedef struct { char c; long double x; } __Pyx_st_longdouble;
24668 typedef struct { char c; void *x; } __Pyx_st_void_p;
24669 #ifdef HAVE_LONG_LONG
24670 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
24671 #endif
24672 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
24673  switch (ch) {
24674  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
24675  case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
24676  case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
24677  case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
24678 #ifdef HAVE_LONG_LONG
24679  case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
24680 #endif
24681  case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
24682  case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
24683  case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
24684  case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
24685  default:
24686  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
24687  return 0;
24688  }
24689 }
24690 /* These are for computing the padding at the end of the struct to align
24691  on the first member of the struct. This will probably the same as above,
24692  but we don't have any guarantees.
24693  */
24694 typedef struct { short x; char c; } __Pyx_pad_short;
24695 typedef struct { int x; char c; } __Pyx_pad_int;
24696 typedef struct { long x; char c; } __Pyx_pad_long;
24697 typedef struct { float x; char c; } __Pyx_pad_float;
24698 typedef struct { double x; char c; } __Pyx_pad_double;
24699 typedef struct { long double x; char c; } __Pyx_pad_longdouble;
24700 typedef struct { void *x; char c; } __Pyx_pad_void_p;
24701 #ifdef HAVE_LONG_LONG
24702 typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
24703 #endif
24704 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
24705  switch (ch) {
24706  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
24707  case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
24708  case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
24709  case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
24710 #ifdef HAVE_LONG_LONG
24711  case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
24712 #endif
24713  case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
24714  case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
24715  case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
24716  case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
24717  default:
24718  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
24719  return 0;
24720  }
24721 }
24722 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
24723  switch (ch) {
24724  case 'c':
24725  return 'H';
24726  case 'b': case 'h': case 'i':
24727  case 'l': case 'q': case 's': case 'p':
24728  return 'I';
24729  case 'B': case 'H': case 'I': case 'L': case 'Q':
24730  return 'U';
24731  case 'f': case 'd': case 'g':
24732  return (is_complex ? 'C' : 'R');
24733  case 'O':
24734  return 'O';
24735  case 'P':
24736  return 'P';
24737  default: {
24738  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
24739  return 0;
24740  }
24741  }
24742 }
24743 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
24744  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
24745  const char* expected;
24746  const char* quote;
24747  if (ctx->head == NULL) {
24748  expected = "end";
24749  quote = "";
24750  } else {
24751  expected = ctx->head->field->type->name;
24752  quote = "'";
24753  }
24754  PyErr_Format(PyExc_ValueError,
24755  "Buffer dtype mismatch, expected %s%s%s but got %s",
24756  quote, expected, quote,
24757  __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
24758  } else {
24759  __Pyx_StructField* field = ctx->head->field;
24760  __Pyx_StructField* parent = (ctx->head - 1)->field;
24761  PyErr_Format(PyExc_ValueError,
24762  "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
24763  field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
24764  parent->type->name, field->name);
24765  }
24766 }
24767 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
24768  char group;
24769  size_t size, offset, arraysize = 1;
24770  if (ctx->enc_type == 0) return 0;
24771  if (ctx->head->field->type->arraysize[0]) {
24772  int i, ndim = 0;
24773  if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
24774  ctx->is_valid_array = ctx->head->field->type->ndim == 1;
24775  ndim = 1;
24776  if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
24777  PyErr_Format(PyExc_ValueError,
24778  "Expected a dimension of size %zu, got %zu",
24779  ctx->head->field->type->arraysize[0], ctx->enc_count);
24780  return -1;
24781  }
24782  }
24783  if (!ctx->is_valid_array) {
24784  PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
24785  ctx->head->field->type->ndim, ndim);
24786  return -1;
24787  }
24788  for (i = 0; i < ctx->head->field->type->ndim; i++) {
24789  arraysize *= ctx->head->field->type->arraysize[i];
24790  }
24791  ctx->is_valid_array = 0;
24792  ctx->enc_count = 1;
24793  }
24794  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
24795  do {
24796  __Pyx_StructField* field = ctx->head->field;
24797  __Pyx_TypeInfo* type = field->type;
24798  if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
24799  size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
24800  } else {
24801  size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
24802  }
24803  if (ctx->enc_packmode == '@') {
24804  size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
24805  size_t align_mod_offset;
24806  if (align_at == 0) return -1;
24807  align_mod_offset = ctx->fmt_offset % align_at;
24808  if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
24809  if (ctx->struct_alignment == 0)
24810  ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
24811  ctx->is_complex);
24812  }
24813  if (type->size != size || type->typegroup != group) {
24814  if (type->typegroup == 'C' && type->fields != NULL) {
24815  size_t parent_offset = ctx->head->parent_offset + field->offset;
24816  ++ctx->head;
24817  ctx->head->field = type->fields;
24818  ctx->head->parent_offset = parent_offset;
24819  continue;
24820  }
24821  if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
24822  } else {
24823  __Pyx_BufFmt_RaiseExpected(ctx);
24824  return -1;
24825  }
24826  }
24827  offset = ctx->head->parent_offset + field->offset;
24828  if (ctx->fmt_offset != offset) {
24829  PyErr_Format(PyExc_ValueError,
24830  "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
24831  (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
24832  return -1;
24833  }
24834  ctx->fmt_offset += size;
24835  if (arraysize)
24836  ctx->fmt_offset += (arraysize - 1) * size;
24837  --ctx->enc_count;
24838  while (1) {
24839  if (field == &ctx->root) {
24840  ctx->head = NULL;
24841  if (ctx->enc_count != 0) {
24842  __Pyx_BufFmt_RaiseExpected(ctx);
24843  return -1;
24844  }
24845  break;
24846  }
24847  ctx->head->field = ++field;
24848  if (field->type == NULL) {
24849  --ctx->head;
24850  field = ctx->head->field;
24851  continue;
24852  } else if (field->type->typegroup == 'S') {
24853  size_t parent_offset = ctx->head->parent_offset + field->offset;
24854  if (field->type->fields->type == NULL) continue;
24855  field = field->type->fields;
24856  ++ctx->head;
24857  ctx->head->field = field;
24858  ctx->head->parent_offset = parent_offset;
24859  break;
24860  } else {
24861  break;
24862  }
24863  }
24864  } while (ctx->enc_count);
24865  ctx->enc_type = 0;
24866  ctx->is_complex = 0;
24867  return 0;
24868 }
24869 static CYTHON_INLINE PyObject *
24870 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
24871 {
24872  const char *ts = *tsp;
24873  int i = 0, number;
24874  int ndim = ctx->head->field->type->ndim;
24875 ;
24876  ++ts;
24877  if (ctx->new_count != 1) {
24878  PyErr_SetString(PyExc_ValueError,
24879  "Cannot handle repeated arrays in format string");
24880  return NULL;
24881  }
24882  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24883  while (*ts && *ts != ')') {
24884  switch (*ts) {
24885  case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
24886  default: break;
24887  }
24888  number = __Pyx_BufFmt_ExpectNumber(&ts);
24889  if (number == -1) return NULL;
24890  if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
24891  return PyErr_Format(PyExc_ValueError,
24892  "Expected a dimension of size %zu, got %d",
24893  ctx->head->field->type->arraysize[i], number);
24894  if (*ts != ',' && *ts != ')')
24895  return PyErr_Format(PyExc_ValueError,
24896  "Expected a comma in format string, got '%c'", *ts);
24897  if (*ts == ',') ts++;
24898  i++;
24899  }
24900  if (i != ndim)
24901  return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
24902  ctx->head->field->type->ndim, i);
24903  if (!*ts) {
24904  PyErr_SetString(PyExc_ValueError,
24905  "Unexpected end of format string, expected ')'");
24906  return NULL;
24907  }
24908  ctx->is_valid_array = 1;
24909  ctx->new_count = 1;
24910  *tsp = ++ts;
24911  return Py_None;
24912 }
24913 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
24914  int got_Z = 0;
24915  while (1) {
24916  switch(*ts) {
24917  case 0:
24918  if (ctx->enc_type != 0 && ctx->head == NULL) {
24919  __Pyx_BufFmt_RaiseExpected(ctx);
24920  return NULL;
24921  }
24922  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24923  if (ctx->head != NULL) {
24924  __Pyx_BufFmt_RaiseExpected(ctx);
24925  return NULL;
24926  }
24927  return ts;
24928  case ' ':
24929  case '\r':
24930  case '\n':
24931  ++ts;
24932  break;
24933  case '<':
24934  if (!__Pyx_IsLittleEndian()) {
24935  PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
24936  return NULL;
24937  }
24938  ctx->new_packmode = '=';
24939  ++ts;
24940  break;
24941  case '>':
24942  case '!':
24943  if (__Pyx_IsLittleEndian()) {
24944  PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
24945  return NULL;
24946  }
24947  ctx->new_packmode = '=';
24948  ++ts;
24949  break;
24950  case '=':
24951  case '@':
24952  case '^':
24953  ctx->new_packmode = *ts++;
24954  break;
24955  case 'T':
24956  {
24957  const char* ts_after_sub;
24958  size_t i, struct_count = ctx->new_count;
24959  size_t struct_alignment = ctx->struct_alignment;
24960  ctx->new_count = 1;
24961  ++ts;
24962  if (*ts != '{') {
24963  PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
24964  return NULL;
24965  }
24966  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24967  ctx->enc_type = 0;
24968  ctx->enc_count = 0;
24969  ctx->struct_alignment = 0;
24970  ++ts;
24971  ts_after_sub = ts;
24972  for (i = 0; i != struct_count; ++i) {
24973  ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
24974  if (!ts_after_sub) return NULL;
24975  }
24976  ts = ts_after_sub;
24977  if (struct_alignment) ctx->struct_alignment = struct_alignment;
24978  }
24979  break;
24980  case '}':
24981  {
24982  size_t alignment = ctx->struct_alignment;
24983  ++ts;
24984  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24985  ctx->enc_type = 0;
24986  if (alignment && ctx->fmt_offset % alignment) {
24987  ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
24988  }
24989  }
24990  return ts;
24991  case 'x':
24992  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24993  ctx->fmt_offset += ctx->new_count;
24994  ctx->new_count = 1;
24995  ctx->enc_count = 0;
24996  ctx->enc_type = 0;
24997  ctx->enc_packmode = ctx->new_packmode;
24998  ++ts;
24999  break;
25000  case 'Z':
25001  got_Z = 1;
25002  ++ts;
25003  if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
25004  __Pyx_BufFmt_RaiseUnexpectedChar('Z');
25005  return NULL;
25006  }
25007  case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
25008  case 'l': case 'L': case 'q': case 'Q':
25009  case 'f': case 'd': case 'g':
25010  case 'O': case 'p':
25011  if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
25012  ctx->enc_packmode == ctx->new_packmode) {
25013  ctx->enc_count += ctx->new_count;
25014  ctx->new_count = 1;
25015  got_Z = 0;
25016  ++ts;
25017  break;
25018  }
25019  case 's':
25020  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25021  ctx->enc_count = ctx->new_count;
25022  ctx->enc_packmode = ctx->new_packmode;
25023  ctx->enc_type = *ts;
25024  ctx->is_complex = got_Z;
25025  ++ts;
25026  ctx->new_count = 1;
25027  got_Z = 0;
25028  break;
25029  case ':':
25030  ++ts;
25031  while(*ts != ':') ++ts;
25032  ++ts;
25033  break;
25034  case '(':
25035  if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
25036  break;
25037  default:
25038  {
25039  int number = __Pyx_BufFmt_ExpectNumber(&ts);
25040  if (number == -1) return NULL;
25041  ctx->new_count = (size_t)number;
25042  }
25043  }
25044  }
25045 }
25046 static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
25047  buf->buf = NULL;
25048  buf->obj = NULL;
25049  buf->strides = __Pyx_zeros;
25050  buf->shape = __Pyx_zeros;
25051  buf->suboffsets = __Pyx_minusones;
25052 }
25053 static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
25054  Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags,
25055  int nd, int cast, __Pyx_BufFmt_StackElem* stack)
25056 {
25057  if (obj == Py_None || obj == NULL) {
25058  __Pyx_ZeroBuffer(buf);
25059  return 0;
25060  }
25061  buf->buf = NULL;
25062  if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
25063  if (buf->ndim != nd) {
25064  PyErr_Format(PyExc_ValueError,
25065  "Buffer has wrong number of dimensions (expected %d, got %d)",
25066  nd, buf->ndim);
25067  goto fail;
25068  }
25069  if (!cast) {
25070  __Pyx_BufFmt_Context ctx;
25071  __Pyx_BufFmt_Init(&ctx, stack, dtype);
25072  if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
25073  }
25074  if ((unsigned)buf->itemsize != dtype->size) {
25075  PyErr_Format(PyExc_ValueError,
25076  "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
25077  buf->itemsize, (buf->itemsize > 1) ? "s" : "",
25078  dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
25079  goto fail;
25080  }
25081  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
25082  return 0;
25083 fail:;
25084  __Pyx_ZeroBuffer(buf);
25085  return -1;
25086 }
25087 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
25088  if (info->buf == NULL) return;
25089  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
25090  __Pyx_ReleaseBuffer(info);
25091 }
25092 
25093 /* BufferIndexError */
25094  static void __Pyx_RaiseBufferIndexError(int axis) {
25095  PyErr_Format(PyExc_IndexError,
25096  "Out of bounds on buffer access (axis %d)", axis);
25097 }
25098 
25099 /* PyErrFetchRestore */
25100  #if CYTHON_FAST_THREAD_STATE
25101 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
25102  PyObject *tmp_type, *tmp_value, *tmp_tb;
25103  tmp_type = tstate->curexc_type;
25104  tmp_value = tstate->curexc_value;
25105  tmp_tb = tstate->curexc_traceback;
25106  tstate->curexc_type = type;
25107  tstate->curexc_value = value;
25108  tstate->curexc_traceback = tb;
25109  Py_XDECREF(tmp_type);
25110  Py_XDECREF(tmp_value);
25111  Py_XDECREF(tmp_tb);
25112 }
25113 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
25114  *type = tstate->curexc_type;
25115  *value = tstate->curexc_value;
25116  *tb = tstate->curexc_traceback;
25117  tstate->curexc_type = 0;
25118  tstate->curexc_value = 0;
25119  tstate->curexc_traceback = 0;
25120 }
25121 #endif
25122 
25123 /* PyFloatBinop */
25124  #if !CYTHON_COMPILING_IN_PYPY
25125 static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, CYTHON_UNUSED int inplace) {
25126  const double b = floatval;
25127  double a, result;
25128  if (likely(PyFloat_CheckExact(op1))) {
25129  a = PyFloat_AS_DOUBLE(op1);
25130  } else
25131  #if PY_MAJOR_VERSION < 3
25132  if (likely(PyInt_CheckExact(op1))) {
25133  a = (double) PyInt_AS_LONG(op1);
25134  } else
25135  #endif
25136  if (likely(PyLong_CheckExact(op1))) {
25137  #if CYTHON_USE_PYLONG_INTERNALS
25138  const digit* digits = ((PyLongObject*)op1)->ob_digit;
25139  const Py_ssize_t size = Py_SIZE(op1);
25140  switch (size) {
25141  case 0: a = 0.0; break;
25142  case -1: a = -(double) digits[0]; break;
25143  case 1: a = (double) digits[0]; break;
25144  case -2:
25145  case 2:
25146  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
25147  a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
25148  if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) (1L<<53))) {
25149  if (size == -2)
25150  a = -a;
25151  break;
25152  }
25153  }
25154  case -3:
25155  case 3:
25156  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
25157  a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
25158  if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) (1L<<53))) {
25159  if (size == -3)
25160  a = -a;
25161  break;
25162  }
25163  }
25164  case -4:
25165  case 4:
25166  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
25167  a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
25168  if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) (1L<<53))) {
25169  if (size == -4)
25170  a = -a;
25171  break;
25172  }
25173  }
25174  default:
25175  #else
25176  {
25177  #endif
25178  a = PyLong_AsDouble(op1);
25179  if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
25180  }
25181  } else {
25182  return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
25183  }
25184  PyFPE_START_PROTECT("add", return NULL)
25185  result = a + b;
25186  PyFPE_END_PROTECT(result)
25187  return PyFloat_FromDouble(result);
25188 }
25189 #endif
25190 
25191 /* PyFunctionFastCall */
25192  #if CYTHON_FAST_PYCALL
25193 #include "frameobject.h"
25194 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
25195  PyObject *globals) {
25196  PyFrameObject *f;
25197  PyThreadState *tstate = PyThreadState_GET();
25198  PyObject **fastlocals;
25199  Py_ssize_t i;
25200  PyObject *result;
25201  assert(globals != NULL);
25202  /* XXX Perhaps we should create a specialized
25203  PyFrame_New() that doesn't take locals, but does
25204  take builtins without sanity checking them.
25205  */
25206  assert(tstate != NULL);
25207  f = PyFrame_New(tstate, co, globals, NULL);
25208  if (f == NULL) {
25209  return NULL;
25210  }
25211  fastlocals = f->f_localsplus;
25212  for (i = 0; i < na; i++) {
25213  Py_INCREF(*args);
25214  fastlocals[i] = *args++;
25215  }
25216  result = PyEval_EvalFrameEx(f,0);
25217  ++tstate->recursion_depth;
25218  Py_DECREF(f);
25219  --tstate->recursion_depth;
25220  return result;
25221 }
25222 #if 1 || PY_VERSION_HEX < 0x030600B1
25223 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
25224  PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
25225  PyObject *globals = PyFunction_GET_GLOBALS(func);
25226  PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
25227  PyObject *closure;
25228 #if PY_MAJOR_VERSION >= 3
25229  PyObject *kwdefs;
25230 #endif
25231  PyObject *kwtuple, **k;
25232  PyObject **d;
25233  Py_ssize_t nd;
25234  Py_ssize_t nk;
25235  PyObject *result;
25236  assert(kwargs == NULL || PyDict_Check(kwargs));
25237  nk = kwargs ? PyDict_Size(kwargs) : 0;
25238  if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
25239  return NULL;
25240  }
25241  if (
25242 #if PY_MAJOR_VERSION >= 3
25243  co->co_kwonlyargcount == 0 &&
25244 #endif
25245  likely(kwargs == NULL || nk == 0) &&
25246  co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
25247  if (argdefs == NULL && co->co_argcount == nargs) {
25248  result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
25249  goto done;
25250  }
25251  else if (nargs == 0 && argdefs != NULL
25252  && co->co_argcount == Py_SIZE(argdefs)) {
25253  /* function called with no arguments, but all parameters have
25254  a default value: use default values as arguments .*/
25255  args = &PyTuple_GET_ITEM(argdefs, 0);
25256  result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
25257  goto done;
25258  }
25259  }
25260  if (kwargs != NULL) {
25261  Py_ssize_t pos, i;
25262  kwtuple = PyTuple_New(2 * nk);
25263  if (kwtuple == NULL) {
25264  result = NULL;
25265  goto done;
25266  }
25267  k = &PyTuple_GET_ITEM(kwtuple, 0);
25268  pos = i = 0;
25269  while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
25270  Py_INCREF(k[i]);
25271  Py_INCREF(k[i+1]);
25272  i += 2;
25273  }
25274  nk = i / 2;
25275  }
25276  else {
25277  kwtuple = NULL;
25278  k = NULL;
25279  }
25280  closure = PyFunction_GET_CLOSURE(func);
25281 #if PY_MAJOR_VERSION >= 3
25282  kwdefs = PyFunction_GET_KW_DEFAULTS(func);
25283 #endif
25284  if (argdefs != NULL) {
25285  d = &PyTuple_GET_ITEM(argdefs, 0);
25286  nd = Py_SIZE(argdefs);
25287  }
25288  else {
25289  d = NULL;
25290  nd = 0;
25291  }
25292 #if PY_MAJOR_VERSION >= 3
25293  result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
25294  args, nargs,
25295  k, (int)nk,
25296  d, (int)nd, kwdefs, closure);
25297 #else
25298  result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
25299  args, nargs,
25300  k, (int)nk,
25301  d, (int)nd, closure);
25302 #endif
25303  Py_XDECREF(kwtuple);
25304 done:
25305  Py_LeaveRecursiveCall();
25306  return result;
25307 }
25308 #endif // CPython < 3.6
25309 #endif // CYTHON_FAST_PYCALL
25310 
25311 /* PyCFunctionFastCall */
25312  #if CYTHON_FAST_PYCCALL
25313 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
25314  PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
25315  PyCFunction meth = PyCFunction_GET_FUNCTION(func);
25316  PyObject *self = PyCFunction_GET_SELF(func);
25317  assert(PyCFunction_Check(func));
25318  assert(METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)));
25319  assert(nargs >= 0);
25320  assert(nargs == 0 || args != NULL);
25321  /* _PyCFunction_FastCallDict() must not be called with an exception set,
25322  because it may clear it (directly or indirectly) and so the
25323  caller loses its exception */
25324  assert(!PyErr_Occurred());
25325  return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL);
25326 }
25327 #endif // CYTHON_FAST_PYCCALL
25328 
25329 /* PyObjectCall */
25330  #if CYTHON_COMPILING_IN_CPYTHON
25331 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
25332  PyObject *result;
25333  ternaryfunc call = func->ob_type->tp_call;
25334  if (unlikely(!call))
25335  return PyObject_Call(func, arg, kw);
25336  if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
25337  return NULL;
25338  result = (*call)(func, arg, kw);
25339  Py_LeaveRecursiveCall();
25340  if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
25341  PyErr_SetString(
25342  PyExc_SystemError,
25343  "NULL result without error in PyObject_Call");
25344  }
25345  return result;
25346 }
25347 #endif
25348 
25349 /* GetModuleGlobalName */
25350  static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
25351  PyObject *result;
25352 #if !CYTHON_AVOID_BORROWED_REFS
25353  result = PyDict_GetItem(__pyx_d, name);
25354  if (likely(result)) {
25355  Py_INCREF(result);
25356  } else {
25357 #else
25358  result = PyObject_GetItem(__pyx_d, name);
25359  if (!result) {
25360  PyErr_Clear();
25361 #endif
25362  result = __Pyx_GetBuiltinName(name);
25363  }
25364  return result;
25365 }
25366 
25367 /* ExtTypeTest */
25368  static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
25369  if (unlikely(!type)) {
25370  PyErr_SetString(PyExc_SystemError, "Missing type object");
25371  return 0;
25372  }
25373  if (likely(PyObject_TypeCheck(obj, type)))
25374  return 1;
25375  PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
25376  Py_TYPE(obj)->tp_name, type->tp_name);
25377  return 0;
25378 }
25379 
25380 /* GetItemInt */
25381  static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
25382  PyObject *r;
25383  if (!j) return NULL;
25384  r = PyObject_GetItem(o, j);
25385  Py_DECREF(j);
25386  return r;
25387 }
25388 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
25389  CYTHON_NCP_UNUSED int wraparound,
25390  CYTHON_NCP_UNUSED int boundscheck) {
25391 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
25392  if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
25393  if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
25394  PyObject *r = PyList_GET_ITEM(o, i);
25395  Py_INCREF(r);
25396  return r;
25397  }
25398  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
25399 #else
25400  return PySequence_GetItem(o, i);
25401 #endif
25402 }
25403 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
25404  CYTHON_NCP_UNUSED int wraparound,
25405  CYTHON_NCP_UNUSED int boundscheck) {
25406 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
25407  if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
25408  if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
25409  PyObject *r = PyTuple_GET_ITEM(o, i);
25410  Py_INCREF(r);
25411  return r;
25412  }
25413  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
25414 #else
25415  return PySequence_GetItem(o, i);
25416 #endif
25417 }
25418 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
25419  CYTHON_NCP_UNUSED int wraparound,
25420  CYTHON_NCP_UNUSED int boundscheck) {
25421 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
25422  if (is_list || PyList_CheckExact(o)) {
25423  Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
25424  if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
25425  PyObject *r = PyList_GET_ITEM(o, n);
25426  Py_INCREF(r);
25427  return r;
25428  }
25429  }
25430  else if (PyTuple_CheckExact(o)) {
25431  Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
25432  if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
25433  PyObject *r = PyTuple_GET_ITEM(o, n);
25434  Py_INCREF(r);
25435  return r;
25436  }
25437  } else {
25438  PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
25439  if (likely(m && m->sq_item)) {
25440  if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
25441  Py_ssize_t l = m->sq_length(o);
25442  if (likely(l >= 0)) {
25443  i += l;
25444  } else {
25445  if (!PyErr_ExceptionMatches(PyExc_OverflowError))
25446  return NULL;
25447  PyErr_Clear();
25448  }
25449  }
25450  return m->sq_item(o, i);
25451  }
25452  }
25453 #else
25454  if (is_list || PySequence_Check(o)) {
25455  return PySequence_GetItem(o, i);
25456  }
25457 #endif
25458  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
25459 }
25460 
25461 /* PyObjectCallMethO */
25462  #if CYTHON_COMPILING_IN_CPYTHON
25463 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
25464  PyObject *self, *result;
25465  PyCFunction cfunc;
25466  cfunc = PyCFunction_GET_FUNCTION(func);
25467  self = PyCFunction_GET_SELF(func);
25468  if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
25469  return NULL;
25470  result = cfunc(self, arg);
25471  Py_LeaveRecursiveCall();
25472  if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
25473  PyErr_SetString(
25474  PyExc_SystemError,
25475  "NULL result without error in PyObject_Call");
25476  }
25477  return result;
25478 }
25479 #endif
25480 
25481 /* PyObjectCallOneArg */
25482  #if CYTHON_COMPILING_IN_CPYTHON
25483 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
25484  PyObject *result;
25485  PyObject *args = PyTuple_New(1);
25486  if (unlikely(!args)) return NULL;
25487  Py_INCREF(arg);
25488  PyTuple_SET_ITEM(args, 0, arg);
25489  result = __Pyx_PyObject_Call(func, args, NULL);
25490  Py_DECREF(args);
25491  return result;
25492 }
25493 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
25494 #if CYTHON_FAST_PYCALL
25495  if (PyFunction_Check(func)) {
25496  return __Pyx_PyFunction_FastCall(func, &arg, 1);
25497  }
25498 #endif
25499 #ifdef __Pyx_CyFunction_USED
25500  if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
25501 #else
25502  if (likely(PyCFunction_Check(func))) {
25503 #endif
25504  if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
25505  return __Pyx_PyObject_CallMethO(func, arg);
25506 #if CYTHON_FAST_PYCCALL
25507  } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
25508  return __Pyx_PyCFunction_FastCall(func, &arg, 1);
25509 #endif
25510  }
25511  }
25512  return __Pyx__PyObject_CallOneArg(func, arg);
25513 }
25514 #else
25515 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
25516  PyObject *result;
25517  PyObject *args = PyTuple_Pack(1, arg);
25518  if (unlikely(!args)) return NULL;
25519  result = __Pyx_PyObject_Call(func, args, NULL);
25520  Py_DECREF(args);
25521  return result;
25522 }
25523 #endif
25524 
25525 /* pyobject_as_double */
25526  static double __Pyx__PyObject_AsDouble(PyObject* obj) {
25527  PyObject* float_value;
25528 #if !CYTHON_USE_TYPE_SLOTS
25529  float_value = PyNumber_Float(obj); if (0) goto bad;
25530 #else
25531  PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number;
25532  if (likely(nb) && likely(nb->nb_float)) {
25533  float_value = nb->nb_float(obj);
25534  if (likely(float_value) && unlikely(!PyFloat_Check(float_value))) {
25535  PyErr_Format(PyExc_TypeError,
25536  "__float__ returned non-float (type %.200s)",
25537  Py_TYPE(float_value)->tp_name);
25538  Py_DECREF(float_value);
25539  goto bad;
25540  }
25541  } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
25542 #if PY_MAJOR_VERSION >= 3
25543  float_value = PyFloat_FromString(obj);
25544 #else
25545  float_value = PyFloat_FromString(obj, 0);
25546 #endif
25547  } else {
25548  PyObject* args = PyTuple_New(1);
25549  if (unlikely(!args)) goto bad;
25550  PyTuple_SET_ITEM(args, 0, obj);
25551  float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
25552  PyTuple_SET_ITEM(args, 0, 0);
25553  Py_DECREF(args);
25554  }
25555 #endif
25556  if (likely(float_value)) {
25557  double value = PyFloat_AS_DOUBLE(float_value);
25558  Py_DECREF(float_value);
25559  return value;
25560  }
25561 bad:
25562  return (double)-1;
25563 }
25564 
25565 /* RaiseException */
25566  #if PY_MAJOR_VERSION < 3
25567 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
25568  CYTHON_UNUSED PyObject *cause) {
25569  __Pyx_PyThreadState_declare
25570  Py_XINCREF(type);
25571  if (!value || value == Py_None)
25572  value = NULL;
25573  else
25574  Py_INCREF(value);
25575  if (!tb || tb == Py_None)
25576  tb = NULL;
25577  else {
25578  Py_INCREF(tb);
25579  if (!PyTraceBack_Check(tb)) {
25580  PyErr_SetString(PyExc_TypeError,
25581  "raise: arg 3 must be a traceback or None");
25582  goto raise_error;
25583  }
25584  }
25585  if (PyType_Check(type)) {
25586 #if CYTHON_COMPILING_IN_PYPY
25587  if (!value) {
25588  Py_INCREF(Py_None);
25589  value = Py_None;
25590  }
25591 #endif
25592  PyErr_NormalizeException(&type, &value, &tb);
25593  } else {
25594  if (value) {
25595  PyErr_SetString(PyExc_TypeError,
25596  "instance exception may not have a separate value");
25597  goto raise_error;
25598  }
25599  value = type;
25600  type = (PyObject*) Py_TYPE(type);
25601  Py_INCREF(type);
25602  if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
25603  PyErr_SetString(PyExc_TypeError,
25604  "raise: exception class must be a subclass of BaseException");
25605  goto raise_error;
25606  }
25607  }
25608  __Pyx_PyThreadState_assign
25609  __Pyx_ErrRestore(type, value, tb);
25610  return;
25611 raise_error:
25612  Py_XDECREF(value);
25613  Py_XDECREF(type);
25614  Py_XDECREF(tb);
25615  return;
25616 }
25617 #else
25618 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
25619  PyObject* owned_instance = NULL;
25620  if (tb == Py_None) {
25621  tb = 0;
25622  } else if (tb && !PyTraceBack_Check(tb)) {
25623  PyErr_SetString(PyExc_TypeError,
25624  "raise: arg 3 must be a traceback or None");
25625  goto bad;
25626  }
25627  if (value == Py_None)
25628  value = 0;
25629  if (PyExceptionInstance_Check(type)) {
25630  if (value) {
25631  PyErr_SetString(PyExc_TypeError,
25632  "instance exception may not have a separate value");
25633  goto bad;
25634  }
25635  value = type;
25636  type = (PyObject*) Py_TYPE(value);
25637  } else if (PyExceptionClass_Check(type)) {
25638  PyObject *instance_class = NULL;
25639  if (value && PyExceptionInstance_Check(value)) {
25640  instance_class = (PyObject*) Py_TYPE(value);
25641  if (instance_class != type) {
25642  int is_subclass = PyObject_IsSubclass(instance_class, type);
25643  if (!is_subclass) {
25644  instance_class = NULL;
25645  } else if (unlikely(is_subclass == -1)) {
25646  goto bad;
25647  } else {
25648  type = instance_class;
25649  }
25650  }
25651  }
25652  if (!instance_class) {
25653  PyObject *args;
25654  if (!value)
25655  args = PyTuple_New(0);
25656  else if (PyTuple_Check(value)) {
25657  Py_INCREF(value);
25658  args = value;
25659  } else
25660  args = PyTuple_Pack(1, value);
25661  if (!args)
25662  goto bad;
25663  owned_instance = PyObject_Call(type, args, NULL);
25664  Py_DECREF(args);
25665  if (!owned_instance)
25666  goto bad;
25667  value = owned_instance;
25668  if (!PyExceptionInstance_Check(value)) {
25669  PyErr_Format(PyExc_TypeError,
25670  "calling %R should have returned an instance of "
25671  "BaseException, not %R",
25672  type, Py_TYPE(value));
25673  goto bad;
25674  }
25675  }
25676  } else {
25677  PyErr_SetString(PyExc_TypeError,
25678  "raise: exception class must be a subclass of BaseException");
25679  goto bad;
25680  }
25681 #if PY_VERSION_HEX >= 0x03030000
25682  if (cause) {
25683 #else
25684  if (cause && cause != Py_None) {
25685 #endif
25686  PyObject *fixed_cause;
25687  if (cause == Py_None) {
25688  fixed_cause = NULL;
25689  } else if (PyExceptionClass_Check(cause)) {
25690  fixed_cause = PyObject_CallObject(cause, NULL);
25691  if (fixed_cause == NULL)
25692  goto bad;
25693  } else if (PyExceptionInstance_Check(cause)) {
25694  fixed_cause = cause;
25695  Py_INCREF(fixed_cause);
25696  } else {
25697  PyErr_SetString(PyExc_TypeError,
25698  "exception causes must derive from "
25699  "BaseException");
25700  goto bad;
25701  }
25702  PyException_SetCause(value, fixed_cause);
25703  }
25704  PyErr_SetObject(type, value);
25705  if (tb) {
25706 #if CYTHON_COMPILING_IN_PYPY
25707  PyObject *tmp_type, *tmp_value, *tmp_tb;
25708  PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
25709  Py_INCREF(tb);
25710  PyErr_Restore(tmp_type, tmp_value, tb);
25711  Py_XDECREF(tmp_tb);
25712 #else
25713  PyThreadState *tstate = PyThreadState_GET();
25714  PyObject* tmp_tb = tstate->curexc_traceback;
25715  if (tb != tmp_tb) {
25716  Py_INCREF(tb);
25717  tstate->curexc_traceback = tb;
25718  Py_XDECREF(tmp_tb);
25719  }
25720 #endif
25721  }
25722 bad:
25723  Py_XDECREF(owned_instance);
25724  return;
25725 }
25726 #endif
25727 
25728 /* RaiseTooManyValuesToUnpack */
25729  static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
25730  PyErr_Format(PyExc_ValueError,
25731  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
25732 }
25733 
25734 /* RaiseNeedMoreValuesToUnpack */
25735  static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
25736  PyErr_Format(PyExc_ValueError,
25737  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
25738  index, (index == 1) ? "" : "s");
25739 }
25740 
25741 /* RaiseNoneIterError */
25742  static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
25743  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
25744 }
25745 
25746 /* SaveResetException */
25747  #if CYTHON_FAST_THREAD_STATE
25748 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
25749  *type = tstate->exc_type;
25750  *value = tstate->exc_value;
25751  *tb = tstate->exc_traceback;
25752  Py_XINCREF(*type);
25753  Py_XINCREF(*value);
25754  Py_XINCREF(*tb);
25755 }
25756 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
25757  PyObject *tmp_type, *tmp_value, *tmp_tb;
25758  tmp_type = tstate->exc_type;
25759  tmp_value = tstate->exc_value;
25760  tmp_tb = tstate->exc_traceback;
25761  tstate->exc_type = type;
25762  tstate->exc_value = value;
25763  tstate->exc_traceback = tb;
25764  Py_XDECREF(tmp_type);
25765  Py_XDECREF(tmp_value);
25766  Py_XDECREF(tmp_tb);
25767 }
25768 #endif
25769 
25770 /* PyErrExceptionMatches */
25771  #if CYTHON_FAST_THREAD_STATE
25772 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
25773  PyObject *exc_type = tstate->curexc_type;
25774  if (exc_type == err) return 1;
25775  if (unlikely(!exc_type)) return 0;
25776  return PyErr_GivenExceptionMatches(exc_type, err);
25777 }
25778 #endif
25779 
25780 /* GetException */
25781  #if CYTHON_FAST_THREAD_STATE
25782 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
25783 #else
25784 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
25785 #endif
25786  PyObject *local_type, *local_value, *local_tb;
25787 #if CYTHON_FAST_THREAD_STATE
25788  PyObject *tmp_type, *tmp_value, *tmp_tb;
25789  local_type = tstate->curexc_type;
25790  local_value = tstate->curexc_value;
25791  local_tb = tstate->curexc_traceback;
25792  tstate->curexc_type = 0;
25793  tstate->curexc_value = 0;
25794  tstate->curexc_traceback = 0;
25795 #else
25796  PyErr_Fetch(&local_type, &local_value, &local_tb);
25797 #endif
25798  PyErr_NormalizeException(&local_type, &local_value, &local_tb);
25799 #if CYTHON_FAST_THREAD_STATE
25800  if (unlikely(tstate->curexc_type))
25801 #else
25802  if (unlikely(PyErr_Occurred()))
25803 #endif
25804  goto bad;
25805  #if PY_MAJOR_VERSION >= 3
25806  if (local_tb) {
25807  if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
25808  goto bad;
25809  }
25810  #endif
25811  Py_XINCREF(local_tb);
25812  Py_XINCREF(local_type);
25813  Py_XINCREF(local_value);
25814  *type = local_type;
25815  *value = local_value;
25816  *tb = local_tb;
25817 #if CYTHON_FAST_THREAD_STATE
25818  tmp_type = tstate->exc_type;
25819  tmp_value = tstate->exc_value;
25820  tmp_tb = tstate->exc_traceback;
25821  tstate->exc_type = local_type;
25822  tstate->exc_value = local_value;
25823  tstate->exc_traceback = local_tb;
25824  Py_XDECREF(tmp_type);
25825  Py_XDECREF(tmp_value);
25826  Py_XDECREF(tmp_tb);
25827 #else
25828  PyErr_SetExcInfo(local_type, local_value, local_tb);
25829 #endif
25830  return 0;
25831 bad:
25832  *type = 0;
25833  *value = 0;
25834  *tb = 0;
25835  Py_XDECREF(local_type);
25836  Py_XDECREF(local_value);
25837  Py_XDECREF(local_tb);
25838  return -1;
25839 }
25840 
25841 /* Import */
25842  static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
25843  PyObject *empty_list = 0;
25844  PyObject *module = 0;
25845  PyObject *global_dict = 0;
25846  PyObject *empty_dict = 0;
25847  PyObject *list;
25848  #if PY_VERSION_HEX < 0x03030000
25849  PyObject *py_import;
25850  py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
25851  if (!py_import)
25852  goto bad;
25853  #endif
25854  if (from_list)
25855  list = from_list;
25856  else {
25857  empty_list = PyList_New(0);
25858  if (!empty_list)
25859  goto bad;
25860  list = empty_list;
25861  }
25862  global_dict = PyModule_GetDict(__pyx_m);
25863  if (!global_dict)
25864  goto bad;
25865  empty_dict = PyDict_New();
25866  if (!empty_dict)
25867  goto bad;
25868  {
25869  #if PY_MAJOR_VERSION >= 3
25870  if (level == -1) {
25871  if (strchr(__Pyx_MODULE_NAME, '.')) {
25872  #if PY_VERSION_HEX < 0x03030000
25873  PyObject *py_level = PyInt_FromLong(1);
25874  if (!py_level)
25875  goto bad;
25876  module = PyObject_CallFunctionObjArgs(py_import,
25877  name, global_dict, empty_dict, list, py_level, NULL);
25878  Py_DECREF(py_level);
25879  #else
25880  module = PyImport_ImportModuleLevelObject(
25881  name, global_dict, empty_dict, list, 1);
25882  #endif
25883  if (!module) {
25884  if (!PyErr_ExceptionMatches(PyExc_ImportError))
25885  goto bad;
25886  PyErr_Clear();
25887  }
25888  }
25889  level = 0;
25890  }
25891  #endif
25892  if (!module) {
25893  #if PY_VERSION_HEX < 0x03030000
25894  PyObject *py_level = PyInt_FromLong(level);
25895  if (!py_level)
25896  goto bad;
25897  module = PyObject_CallFunctionObjArgs(py_import,
25898  name, global_dict, empty_dict, list, py_level, NULL);
25899  Py_DECREF(py_level);
25900  #else
25901  module = PyImport_ImportModuleLevelObject(
25902  name, global_dict, empty_dict, list, level);
25903  #endif
25904  }
25905  }
25906 bad:
25907  #if PY_VERSION_HEX < 0x03030000
25908  Py_XDECREF(py_import);
25909  #endif
25910  Py_XDECREF(empty_list);
25911  Py_XDECREF(empty_dict);
25912  return module;
25913 }
25914 
25915 /* CodeObjectCache */
25916  static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
25917  int start = 0, mid = 0, end = count - 1;
25918  if (end >= 0 && code_line > entries[end].code_line) {
25919  return count;
25920  }
25921  while (start < end) {
25922  mid = start + (end - start) / 2;
25923  if (code_line < entries[mid].code_line) {
25924  end = mid;
25925  } else if (code_line > entries[mid].code_line) {
25926  start = mid + 1;
25927  } else {
25928  return mid;
25929  }
25930  }
25931  if (code_line <= entries[mid].code_line) {
25932  return mid;
25933  } else {
25934  return mid + 1;
25935  }
25936 }
25937 static PyCodeObject *__pyx_find_code_object(int code_line) {
25938  PyCodeObject* code_object;
25939  int pos;
25940  if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
25941  return NULL;
25942  }
25943  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
25944  if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
25945  return NULL;
25946  }
25947  code_object = __pyx_code_cache.entries[pos].code_object;
25948  Py_INCREF(code_object);
25949  return code_object;
25950 }
25951 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
25952  int pos, i;
25953  __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
25954  if (unlikely(!code_line)) {
25955  return;
25956  }
25957  if (unlikely(!entries)) {
25958  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
25959  if (likely(entries)) {
25960  __pyx_code_cache.entries = entries;
25961  __pyx_code_cache.max_count = 64;
25962  __pyx_code_cache.count = 1;
25963  entries[0].code_line = code_line;
25964  entries[0].code_object = code_object;
25965  Py_INCREF(code_object);
25966  }
25967  return;
25968  }
25969  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
25970  if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
25971  PyCodeObject* tmp = entries[pos].code_object;
25972  entries[pos].code_object = code_object;
25973  Py_DECREF(tmp);
25974  return;
25975  }
25976  if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
25977  int new_max = __pyx_code_cache.max_count + 64;
25978  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
25979  __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
25980  if (unlikely(!entries)) {
25981  return;
25982  }
25983  __pyx_code_cache.entries = entries;
25984  __pyx_code_cache.max_count = new_max;
25985  }
25986  for (i=__pyx_code_cache.count; i>pos; i--) {
25987  entries[i] = entries[i-1];
25988  }
25989  entries[pos].code_line = code_line;
25990  entries[pos].code_object = code_object;
25991  __pyx_code_cache.count++;
25992  Py_INCREF(code_object);
25993 }
25994 
25995 /* AddTraceback */
25996  #include "compile.h"
25997 #include "frameobject.h"
25998 #include "traceback.h"
25999 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
26000  const char *funcname, int c_line,
26001  int py_line, const char *filename) {
26002  PyCodeObject *py_code = 0;
26003  PyObject *py_srcfile = 0;
26004  PyObject *py_funcname = 0;
26005  #if PY_MAJOR_VERSION < 3
26006  py_srcfile = PyString_FromString(filename);
26007  #else
26008  py_srcfile = PyUnicode_FromString(filename);
26009  #endif
26010  if (!py_srcfile) goto bad;
26011  if (c_line) {
26012  #if PY_MAJOR_VERSION < 3
26013  py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
26014  #else
26015  py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
26016  #endif
26017  }
26018  else {
26019  #if PY_MAJOR_VERSION < 3
26020  py_funcname = PyString_FromString(funcname);
26021  #else
26022  py_funcname = PyUnicode_FromString(funcname);
26023  #endif
26024  }
26025  if (!py_funcname) goto bad;
26026  py_code = __Pyx_PyCode_New(
26027  0,
26028  0,
26029  0,
26030  0,
26031  0,
26032  __pyx_empty_bytes, /*PyObject *code,*/
26033  __pyx_empty_tuple, /*PyObject *consts,*/
26034  __pyx_empty_tuple, /*PyObject *names,*/
26035  __pyx_empty_tuple, /*PyObject *varnames,*/
26036  __pyx_empty_tuple, /*PyObject *freevars,*/
26037  __pyx_empty_tuple, /*PyObject *cellvars,*/
26038  py_srcfile, /*PyObject *filename,*/
26039  py_funcname, /*PyObject *name,*/
26040  py_line,
26041  __pyx_empty_bytes /*PyObject *lnotab*/
26042  );
26043  Py_DECREF(py_srcfile);
26044  Py_DECREF(py_funcname);
26045  return py_code;
26046 bad:
26047  Py_XDECREF(py_srcfile);
26048  Py_XDECREF(py_funcname);
26049  return NULL;
26050 }
26051 static void __Pyx_AddTraceback(const char *funcname, int c_line,
26052  int py_line, const char *filename) {
26053  PyCodeObject *py_code = 0;
26054  PyFrameObject *py_frame = 0;
26055  py_code = __pyx_find_code_object(c_line ? c_line : py_line);
26056  if (!py_code) {
26057  py_code = __Pyx_CreateCodeObjectForTraceback(
26058  funcname, c_line, py_line, filename);
26059  if (!py_code) goto bad;
26060  __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
26061  }
26062  py_frame = PyFrame_New(
26063  PyThreadState_GET(), /*PyThreadState *tstate,*/
26064  py_code, /*PyCodeObject *code,*/
26065  __pyx_d, /*PyObject *globals,*/
26066  0 /*PyObject *locals*/
26067  );
26068  if (!py_frame) goto bad;
26069  __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
26070  PyTraceBack_Here(py_frame);
26071 bad:
26072  Py_XDECREF(py_code);
26073  Py_XDECREF(py_frame);
26074 }
26075 
26076 #if PY_MAJOR_VERSION < 3
26077 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
26078  if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
26079  if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
26080  PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
26081  return -1;
26082 }
26083 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
26084  PyObject *obj = view->obj;
26085  if (!obj) return;
26086  if (PyObject_CheckBuffer(obj)) {
26087  PyBuffer_Release(view);
26088  return;
26089  }
26090  if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; }
26091  Py_DECREF(obj);
26092  view->obj = NULL;
26093 }
26094 #endif
26095 
26096 
26097  /* CIntFromPyVerify */
26098  #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
26099  __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
26100 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
26101  __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
26102 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
26103  {\
26104  func_type value = func_value;\
26105  if (sizeof(target_type) < sizeof(func_type)) {\
26106  if (unlikely(value != (func_type) (target_type) value)) {\
26107  func_type zero = 0;\
26108  if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
26109  return (target_type) -1;\
26110  if (is_unsigned && unlikely(value < zero))\
26111  goto raise_neg_overflow;\
26112  else\
26113  goto raise_overflow;\
26114  }\
26115  }\
26116  return (target_type) value;\
26117  }
26118 
26119 /* CIntToPy */
26120  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
26121  const int neg_one = (int) -1, const_zero = (int) 0;
26122  const int is_unsigned = neg_one > const_zero;
26123  if (is_unsigned) {
26124  if (sizeof(int) < sizeof(long)) {
26125  return PyInt_FromLong((long) value);
26126  } else if (sizeof(int) <= sizeof(unsigned long)) {
26127  return PyLong_FromUnsignedLong((unsigned long) value);
26128 #ifdef HAVE_LONG_LONG
26129  } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
26130  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
26131 #endif
26132  }
26133  } else {
26134  if (sizeof(int) <= sizeof(long)) {
26135  return PyInt_FromLong((long) value);
26136 #ifdef HAVE_LONG_LONG
26137  } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
26138  return PyLong_FromLongLong((PY_LONG_LONG) value);
26139 #endif
26140  }
26141  }
26142  {
26143  int one = 1; int little = (int)*(unsigned char *)&one;
26144  unsigned char *bytes = (unsigned char *)&value;
26145  return _PyLong_FromByteArray(bytes, sizeof(int),
26146  little, !is_unsigned);
26147  }
26148 }
26149 
26150 /* CIntToPy */
26151  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) {
26152  const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = (Py_intptr_t) 0;
26153  const int is_unsigned = neg_one > const_zero;
26154  if (is_unsigned) {
26155  if (sizeof(Py_intptr_t) < sizeof(long)) {
26156  return PyInt_FromLong((long) value);
26157  } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
26158  return PyLong_FromUnsignedLong((unsigned long) value);
26159 #ifdef HAVE_LONG_LONG
26160  } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
26161  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
26162 #endif
26163  }
26164  } else {
26165  if (sizeof(Py_intptr_t) <= sizeof(long)) {
26166  return PyInt_FromLong((long) value);
26167 #ifdef HAVE_LONG_LONG
26168  } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
26169  return PyLong_FromLongLong((PY_LONG_LONG) value);
26170 #endif
26171  }
26172  }
26173  {
26174  int one = 1; int little = (int)*(unsigned char *)&one;
26175  unsigned char *bytes = (unsigned char *)&value;
26176  return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t),
26177  little, !is_unsigned);
26178  }
26179 }
26180 
26181 /* CIntToPy */
26182  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
26183  const long neg_one = (long) -1, const_zero = (long) 0;
26184  const int is_unsigned = neg_one > const_zero;
26185  if (is_unsigned) {
26186  if (sizeof(long) < sizeof(long)) {
26187  return PyInt_FromLong((long) value);
26188  } else if (sizeof(long) <= sizeof(unsigned long)) {
26189  return PyLong_FromUnsignedLong((unsigned long) value);
26190 #ifdef HAVE_LONG_LONG
26191  } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
26192  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
26193 #endif
26194  }
26195  } else {
26196  if (sizeof(long) <= sizeof(long)) {
26197  return PyInt_FromLong((long) value);
26198 #ifdef HAVE_LONG_LONG
26199  } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
26200  return PyLong_FromLongLong((PY_LONG_LONG) value);
26201 #endif
26202  }
26203  }
26204  {
26205  int one = 1; int little = (int)*(unsigned char *)&one;
26206  unsigned char *bytes = (unsigned char *)&value;
26207  return _PyLong_FromByteArray(bytes, sizeof(long),
26208  little, !is_unsigned);
26209  }
26210 }
26211 
26212 /* Declarations */
26213  #if CYTHON_CCOMPLEX
26214  #ifdef __cplusplus
26215  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
26216  return ::std::complex< float >(x, y);
26217  }
26218  #else
26219  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
26220  return x + y*(__pyx_t_float_complex)_Complex_I;
26221  }
26222  #endif
26223 #else
26224  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
26225  __pyx_t_float_complex z;
26226  z.real = x;
26227  z.imag = y;
26228  return z;
26229  }
26230 #endif
26231 
26232 /* Arithmetic */
26233  #if CYTHON_CCOMPLEX
26234 #else
26235  static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26236  return (a.real == b.real) && (a.imag == b.imag);
26237  }
26238  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26239  __pyx_t_float_complex z;
26240  z.real = a.real + b.real;
26241  z.imag = a.imag + b.imag;
26242  return z;
26243  }
26244  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26245  __pyx_t_float_complex z;
26246  z.real = a.real - b.real;
26247  z.imag = a.imag - b.imag;
26248  return z;
26249  }
26250  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26251  __pyx_t_float_complex z;
26252  z.real = a.real * b.real - a.imag * b.imag;
26253  z.imag = a.real * b.imag + a.imag * b.real;
26254  return z;
26255  }
26256  #if 1
26257  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26258  if (b.imag == 0) {
26259  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
26260  } else if (fabsf(b.real) >= fabsf(b.imag)) {
26261  if (b.real == 0 && b.imag == 0) {
26262  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
26263  } else {
26264  float r = b.imag / b.real;
26265  float s = 1.0 / (b.real + b.imag * r);
26266  return __pyx_t_float_complex_from_parts(
26267  (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
26268  }
26269  } else {
26270  float r = b.real / b.imag;
26271  float s = 1.0 / (b.imag + b.real * r);
26272  return __pyx_t_float_complex_from_parts(
26273  (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
26274  }
26275  }
26276  #else
26277  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26278  if (b.imag == 0) {
26279  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
26280  } else {
26281  float denom = b.real * b.real + b.imag * b.imag;
26282  return __pyx_t_float_complex_from_parts(
26283  (a.real * b.real + a.imag * b.imag) / denom,
26284  (a.imag * b.real - a.real * b.imag) / denom);
26285  }
26286  }
26287  #endif
26288  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
26289  __pyx_t_float_complex z;
26290  z.real = -a.real;
26291  z.imag = -a.imag;
26292  return z;
26293  }
26294  static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
26295  return (a.real == 0) && (a.imag == 0);
26296  }
26297  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
26298  __pyx_t_float_complex z;
26299  z.real = a.real;
26300  z.imag = -a.imag;
26301  return z;
26302  }
26303  #if 1
26304  static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
26305  #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
26306  return sqrtf(z.real*z.real + z.imag*z.imag);
26307  #else
26308  return hypotf(z.real, z.imag);
26309  #endif
26310  }
26311  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26312  __pyx_t_float_complex z;
26313  float r, lnr, theta, z_r, z_theta;
26314  if (b.imag == 0 && b.real == (int)b.real) {
26315  if (b.real < 0) {
26316  float denom = a.real * a.real + a.imag * a.imag;
26317  a.real = a.real / denom;
26318  a.imag = -a.imag / denom;
26319  b.real = -b.real;
26320  }
26321  switch ((int)b.real) {
26322  case 0:
26323  z.real = 1;
26324  z.imag = 0;
26325  return z;
26326  case 1:
26327  return a;
26328  case 2:
26329  z = __Pyx_c_prod_float(a, a);
26330  return __Pyx_c_prod_float(a, a);
26331  case 3:
26332  z = __Pyx_c_prod_float(a, a);
26333  return __Pyx_c_prod_float(z, a);
26334  case 4:
26335  z = __Pyx_c_prod_float(a, a);
26336  return __Pyx_c_prod_float(z, z);
26337  }
26338  }
26339  if (a.imag == 0) {
26340  if (a.real == 0) {
26341  return a;
26342  } else if (b.imag == 0) {
26343  z.real = powf(a.real, b.real);
26344  z.imag = 0;
26345  return z;
26346  } else if (a.real > 0) {
26347  r = a.real;
26348  theta = 0;
26349  } else {
26350  r = -a.real;
26351  theta = atan2f(0, -1);
26352  }
26353  } else {
26354  r = __Pyx_c_abs_float(a);
26355  theta = atan2f(a.imag, a.real);
26356  }
26357  lnr = logf(r);
26358  z_r = expf(lnr * b.real - theta * b.imag);
26359  z_theta = theta * b.real + lnr * b.imag;
26360  z.real = z_r * cosf(z_theta);
26361  z.imag = z_r * sinf(z_theta);
26362  return z;
26363  }
26364  #endif
26365 #endif
26366 
26367 /* Declarations */
26368  #if CYTHON_CCOMPLEX
26369  #ifdef __cplusplus
26370  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
26371  return ::std::complex< double >(x, y);
26372  }
26373  #else
26374  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
26375  return x + y*(__pyx_t_double_complex)_Complex_I;
26376  }
26377  #endif
26378 #else
26379  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
26380  __pyx_t_double_complex z;
26381  z.real = x;
26382  z.imag = y;
26383  return z;
26384  }
26385 #endif
26386 
26387 /* Arithmetic */
26388  #if CYTHON_CCOMPLEX
26389 #else
26390  static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26391  return (a.real == b.real) && (a.imag == b.imag);
26392  }
26393  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26394  __pyx_t_double_complex z;
26395  z.real = a.real + b.real;
26396  z.imag = a.imag + b.imag;
26397  return z;
26398  }
26399  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26400  __pyx_t_double_complex z;
26401  z.real = a.real - b.real;
26402  z.imag = a.imag - b.imag;
26403  return z;
26404  }
26405  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26406  __pyx_t_double_complex z;
26407  z.real = a.real * b.real - a.imag * b.imag;
26408  z.imag = a.real * b.imag + a.imag * b.real;
26409  return z;
26410  }
26411  #if 1
26412  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26413  if (b.imag == 0) {
26414  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
26415  } else if (fabs(b.real) >= fabs(b.imag)) {
26416  if (b.real == 0 && b.imag == 0) {
26417  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
26418  } else {
26419  double r = b.imag / b.real;
26420  double s = 1.0 / (b.real + b.imag * r);
26421  return __pyx_t_double_complex_from_parts(
26422  (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
26423  }
26424  } else {
26425  double r = b.real / b.imag;
26426  double s = 1.0 / (b.imag + b.real * r);
26427  return __pyx_t_double_complex_from_parts(
26428  (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
26429  }
26430  }
26431  #else
26432  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26433  if (b.imag == 0) {
26434  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
26435  } else {
26436  double denom = b.real * b.real + b.imag * b.imag;
26437  return __pyx_t_double_complex_from_parts(
26438  (a.real * b.real + a.imag * b.imag) / denom,
26439  (a.imag * b.real - a.real * b.imag) / denom);
26440  }
26441  }
26442  #endif
26443  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
26444  __pyx_t_double_complex z;
26445  z.real = -a.real;
26446  z.imag = -a.imag;
26447  return z;
26448  }
26449  static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
26450  return (a.real == 0) && (a.imag == 0);
26451  }
26452  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
26453  __pyx_t_double_complex z;
26454  z.real = a.real;
26455  z.imag = -a.imag;
26456  return z;
26457  }
26458  #if 1
26459  static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
26460  #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
26461  return sqrt(z.real*z.real + z.imag*z.imag);
26462  #else
26463  return hypot(z.real, z.imag);
26464  #endif
26465  }
26466  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26467  __pyx_t_double_complex z;
26468  double r, lnr, theta, z_r, z_theta;
26469  if (b.imag == 0 && b.real == (int)b.real) {
26470  if (b.real < 0) {
26471  double denom = a.real * a.real + a.imag * a.imag;
26472  a.real = a.real / denom;
26473  a.imag = -a.imag / denom;
26474  b.real = -b.real;
26475  }
26476  switch ((int)b.real) {
26477  case 0:
26478  z.real = 1;
26479  z.imag = 0;
26480  return z;
26481  case 1:
26482  return a;
26483  case 2:
26484  z = __Pyx_c_prod_double(a, a);
26485  return __Pyx_c_prod_double(a, a);
26486  case 3:
26487  z = __Pyx_c_prod_double(a, a);
26488  return __Pyx_c_prod_double(z, a);
26489  case 4:
26490  z = __Pyx_c_prod_double(a, a);
26491  return __Pyx_c_prod_double(z, z);
26492  }
26493  }
26494  if (a.imag == 0) {
26495  if (a.real == 0) {
26496  return a;
26497  } else if (b.imag == 0) {
26498  z.real = pow(a.real, b.real);
26499  z.imag = 0;
26500  return z;
26501  } else if (a.real > 0) {
26502  r = a.real;
26503  theta = 0;
26504  } else {
26505  r = -a.real;
26506  theta = atan2(0, -1);
26507  }
26508  } else {
26509  r = __Pyx_c_abs_double(a);
26510  theta = atan2(a.imag, a.real);
26511  }
26512  lnr = log(r);
26513  z_r = exp(lnr * b.real - theta * b.imag);
26514  z_theta = theta * b.real + lnr * b.imag;
26515  z.real = z_r * cos(z_theta);
26516  z.imag = z_r * sin(z_theta);
26517  return z;
26518  }
26519  #endif
26520 #endif
26521 
26522 /* CIntToPy */
26523  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
26524  const enum NPY_TYPES neg_one = (enum NPY_TYPES) -1, const_zero = (enum NPY_TYPES) 0;
26525  const int is_unsigned = neg_one > const_zero;
26526  if (is_unsigned) {
26527  if (sizeof(enum NPY_TYPES) < sizeof(long)) {
26528  return PyInt_FromLong((long) value);
26529  } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
26530  return PyLong_FromUnsignedLong((unsigned long) value);
26531 #ifdef HAVE_LONG_LONG
26532  } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
26533  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
26534 #endif
26535  }
26536  } else {
26537  if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
26538  return PyInt_FromLong((long) value);
26539 #ifdef HAVE_LONG_LONG
26540  } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
26541  return PyLong_FromLongLong((PY_LONG_LONG) value);
26542 #endif
26543  }
26544  }
26545  {
26546  int one = 1; int little = (int)*(unsigned char *)&one;
26547  unsigned char *bytes = (unsigned char *)&value;
26548  return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
26549  little, !is_unsigned);
26550  }
26551 }
26552 
26553 /* CIntFromPy */
26554  static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
26555  const int neg_one = (int) -1, const_zero = (int) 0;
26556  const int is_unsigned = neg_one > const_zero;
26557 #if PY_MAJOR_VERSION < 3
26558  if (likely(PyInt_Check(x))) {
26559  if (sizeof(int) < sizeof(long)) {
26560  __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
26561  } else {
26562  long val = PyInt_AS_LONG(x);
26563  if (is_unsigned && unlikely(val < 0)) {
26564  goto raise_neg_overflow;
26565  }
26566  return (int) val;
26567  }
26568  } else
26569 #endif
26570  if (likely(PyLong_Check(x))) {
26571  if (is_unsigned) {
26572 #if CYTHON_USE_PYLONG_INTERNALS
26573  const digit* digits = ((PyLongObject*)x)->ob_digit;
26574  switch (Py_SIZE(x)) {
26575  case 0: return (int) 0;
26576  case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
26577  case 2:
26578  if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
26579  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26580  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26581  } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
26582  return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
26583  }
26584  }
26585  break;
26586  case 3:
26587  if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
26588  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26589  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26590  } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
26591  return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
26592  }
26593  }
26594  break;
26595  case 4:
26596  if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
26597  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26598  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26599  } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
26600  return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
26601  }
26602  }
26603  break;
26604  }
26605 #endif
26606 #if CYTHON_COMPILING_IN_CPYTHON
26607  if (unlikely(Py_SIZE(x) < 0)) {
26608  goto raise_neg_overflow;
26609  }
26610 #else
26611  {
26612  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
26613  if (unlikely(result < 0))
26614  return (int) -1;
26615  if (unlikely(result == 1))
26616  goto raise_neg_overflow;
26617  }
26618 #endif
26619  if (sizeof(int) <= sizeof(unsigned long)) {
26620  __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
26621 #ifdef HAVE_LONG_LONG
26622  } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
26623  __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
26624 #endif
26625  }
26626  } else {
26627 #if CYTHON_USE_PYLONG_INTERNALS
26628  const digit* digits = ((PyLongObject*)x)->ob_digit;
26629  switch (Py_SIZE(x)) {
26630  case 0: return (int) 0;
26631  case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
26632  case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
26633  case -2:
26634  if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
26635  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26636  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26637  } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
26638  return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
26639  }
26640  }
26641  break;
26642  case 2:
26643  if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
26644  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26645  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26646  } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
26647  return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
26648  }
26649  }
26650  break;
26651  case -3:
26652  if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
26653  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26654  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26655  } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
26656  return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
26657  }
26658  }
26659  break;
26660  case 3:
26661  if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
26662  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26663  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26664  } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
26665  return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
26666  }
26667  }
26668  break;
26669  case -4:
26670  if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
26671  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26672  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26673  } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
26674  return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
26675  }
26676  }
26677  break;
26678  case 4:
26679  if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
26680  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26681  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26682  } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
26683  return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
26684  }
26685  }
26686  break;
26687  }
26688 #endif
26689  if (sizeof(int) <= sizeof(long)) {
26690  __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
26691 #ifdef HAVE_LONG_LONG
26692  } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
26693  __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
26694 #endif
26695  }
26696  }
26697  {
26698 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
26699  PyErr_SetString(PyExc_RuntimeError,
26700  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
26701 #else
26702  int val;
26703  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
26704  #if PY_MAJOR_VERSION < 3
26705  if (likely(v) && !PyLong_Check(v)) {
26706  PyObject *tmp = v;
26707  v = PyNumber_Long(tmp);
26708  Py_DECREF(tmp);
26709  }
26710  #endif
26711  if (likely(v)) {
26712  int one = 1; int is_little = (int)*(unsigned char *)&one;
26713  unsigned char *bytes = (unsigned char *)&val;
26714  int ret = _PyLong_AsByteArray((PyLongObject *)v,
26715  bytes, sizeof(val),
26716  is_little, !is_unsigned);
26717  Py_DECREF(v);
26718  if (likely(!ret))
26719  return val;
26720  }
26721 #endif
26722  return (int) -1;
26723  }
26724  } else {
26725  int val;
26726  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
26727  if (!tmp) return (int) -1;
26728  val = __Pyx_PyInt_As_int(tmp);
26729  Py_DECREF(tmp);
26730  return val;
26731  }
26732 raise_overflow:
26733  PyErr_SetString(PyExc_OverflowError,
26734  "value too large to convert to int");
26735  return (int) -1;
26736 raise_neg_overflow:
26737  PyErr_SetString(PyExc_OverflowError,
26738  "can't convert negative value to int");
26739  return (int) -1;
26740 }
26741 
26742 /* CIntFromPy */
26743  static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_As_Py_intptr_t(PyObject *x) {
26744  const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = (Py_intptr_t) 0;
26745  const int is_unsigned = neg_one > const_zero;
26746 #if PY_MAJOR_VERSION < 3
26747  if (likely(PyInt_Check(x))) {
26748  if (sizeof(Py_intptr_t) < sizeof(long)) {
26749  __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, PyInt_AS_LONG(x))
26750  } else {
26751  long val = PyInt_AS_LONG(x);
26752  if (is_unsigned && unlikely(val < 0)) {
26753  goto raise_neg_overflow;
26754  }
26755  return (Py_intptr_t) val;
26756  }
26757  } else
26758 #endif
26759  if (likely(PyLong_Check(x))) {
26760  if (is_unsigned) {
26761 #if CYTHON_USE_PYLONG_INTERNALS
26762  const digit* digits = ((PyLongObject*)x)->ob_digit;
26763  switch (Py_SIZE(x)) {
26764  case 0: return (Py_intptr_t) 0;
26765  case 1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, digit, digits[0])
26766  case 2:
26767  if (8 * sizeof(Py_intptr_t) > 1 * PyLong_SHIFT) {
26768  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26769  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26770  } else if (8 * sizeof(Py_intptr_t) >= 2 * PyLong_SHIFT) {
26771  return (Py_intptr_t) (((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
26772  }
26773  }
26774  break;
26775  case 3:
26776  if (8 * sizeof(Py_intptr_t) > 2 * PyLong_SHIFT) {
26777  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26778  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26779  } else if (8 * sizeof(Py_intptr_t) >= 3 * PyLong_SHIFT) {
26780  return (Py_intptr_t) (((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
26781  }
26782  }
26783  break;
26784  case 4:
26785  if (8 * sizeof(Py_intptr_t) > 3 * PyLong_SHIFT) {
26786  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26787  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26788  } else if (8 * sizeof(Py_intptr_t) >= 4 * PyLong_SHIFT) {
26789  return (Py_intptr_t) (((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
26790  }
26791  }
26792  break;
26793  }
26794 #endif
26795 #if CYTHON_COMPILING_IN_CPYTHON
26796  if (unlikely(Py_SIZE(x) < 0)) {
26797  goto raise_neg_overflow;
26798  }
26799 #else
26800  {
26801  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
26802  if (unlikely(result < 0))
26803  return (Py_intptr_t) -1;
26804  if (unlikely(result == 1))
26805  goto raise_neg_overflow;
26806  }
26807 #endif
26808  if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
26809  __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, unsigned long, PyLong_AsUnsignedLong(x))
26810 #ifdef HAVE_LONG_LONG
26811  } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
26812  __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
26813 #endif
26814  }
26815  } else {
26816 #if CYTHON_USE_PYLONG_INTERNALS
26817  const digit* digits = ((PyLongObject*)x)->ob_digit;
26818  switch (Py_SIZE(x)) {
26819  case 0: return (Py_intptr_t) 0;
26820  case -1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, sdigit, (sdigit) (-(sdigit)digits[0]))
26821  case 1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, digit, +digits[0])
26822  case -2:
26823  if (8 * sizeof(Py_intptr_t) - 1 > 1 * PyLong_SHIFT) {
26824  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26825  __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26826  } else if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
26827  return (Py_intptr_t) (((Py_intptr_t)-1)*(((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26828  }
26829  }
26830  break;
26831  case 2:
26832  if (8 * sizeof(Py_intptr_t) > 1 * PyLong_SHIFT) {
26833  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26834  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26835  } else if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
26836  return (Py_intptr_t) ((((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26837  }
26838  }
26839  break;
26840  case -3:
26841  if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
26842  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26843  __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26844  } else if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
26845  return (Py_intptr_t) (((Py_intptr_t)-1)*(((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26846  }
26847  }
26848  break;
26849  case 3:
26850  if (8 * sizeof(Py_intptr_t) > 2 * PyLong_SHIFT) {
26851  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26852  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26853  } else if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
26854  return (Py_intptr_t) ((((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26855  }
26856  }
26857  break;
26858  case -4:
26859  if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
26860  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26861  __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26862  } else if (8 * sizeof(Py_intptr_t) - 1 > 4 * PyLong_SHIFT) {
26863  return (Py_intptr_t) (((Py_intptr_t)-1)*(((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26864  }
26865  }
26866  break;
26867  case 4:
26868  if (8 * sizeof(Py_intptr_t) > 3 * PyLong_SHIFT) {
26869  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26870  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26871  } else if (8 * sizeof(Py_intptr_t) - 1 > 4 * PyLong_SHIFT) {
26872  return (Py_intptr_t) ((((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26873  }
26874  }
26875  break;
26876  }
26877 #endif
26878  if (sizeof(Py_intptr_t) <= sizeof(long)) {
26879  __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, long, PyLong_AsLong(x))
26880 #ifdef HAVE_LONG_LONG
26881  } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
26882  __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, PY_LONG_LONG, PyLong_AsLongLong(x))
26883 #endif
26884  }
26885  }
26886  {
26887 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
26888  PyErr_SetString(PyExc_RuntimeError,
26889  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
26890 #else
26891  Py_intptr_t val;
26892  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
26893  #if PY_MAJOR_VERSION < 3
26894  if (likely(v) && !PyLong_Check(v)) {
26895  PyObject *tmp = v;
26896  v = PyNumber_Long(tmp);
26897  Py_DECREF(tmp);
26898  }
26899  #endif
26900  if (likely(v)) {
26901  int one = 1; int is_little = (int)*(unsigned char *)&one;
26902  unsigned char *bytes = (unsigned char *)&val;
26903  int ret = _PyLong_AsByteArray((PyLongObject *)v,
26904  bytes, sizeof(val),
26905  is_little, !is_unsigned);
26906  Py_DECREF(v);
26907  if (likely(!ret))
26908  return val;
26909  }
26910 #endif
26911  return (Py_intptr_t) -1;
26912  }
26913  } else {
26914  Py_intptr_t val;
26915  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
26916  if (!tmp) return (Py_intptr_t) -1;
26917  val = __Pyx_PyInt_As_Py_intptr_t(tmp);
26918  Py_DECREF(tmp);
26919  return val;
26920  }
26921 raise_overflow:
26922  PyErr_SetString(PyExc_OverflowError,
26923  "value too large to convert to Py_intptr_t");
26924  return (Py_intptr_t) -1;
26925 raise_neg_overflow:
26926  PyErr_SetString(PyExc_OverflowError,
26927  "can't convert negative value to Py_intptr_t");
26928  return (Py_intptr_t) -1;
26929 }
26930 
26931 /* CIntFromPy */
26932  static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
26933  const long neg_one = (long) -1, const_zero = (long) 0;
26934  const int is_unsigned = neg_one > const_zero;
26935 #if PY_MAJOR_VERSION < 3
26936  if (likely(PyInt_Check(x))) {
26937  if (sizeof(long) < sizeof(long)) {
26938  __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
26939  } else {
26940  long val = PyInt_AS_LONG(x);
26941  if (is_unsigned && unlikely(val < 0)) {
26942  goto raise_neg_overflow;
26943  }
26944  return (long) val;
26945  }
26946  } else
26947 #endif
26948  if (likely(PyLong_Check(x))) {
26949  if (is_unsigned) {
26950 #if CYTHON_USE_PYLONG_INTERNALS
26951  const digit* digits = ((PyLongObject*)x)->ob_digit;
26952  switch (Py_SIZE(x)) {
26953  case 0: return (long) 0;
26954  case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
26955  case 2:
26956  if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
26957  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26958  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26959  } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
26960  return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
26961  }
26962  }
26963  break;
26964  case 3:
26965  if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
26966  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26967  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26968  } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
26969  return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
26970  }
26971  }
26972  break;
26973  case 4:
26974  if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
26975  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26976  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26977  } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
26978  return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
26979  }
26980  }
26981  break;
26982  }
26983 #endif
26984 #if CYTHON_COMPILING_IN_CPYTHON
26985  if (unlikely(Py_SIZE(x) < 0)) {
26986  goto raise_neg_overflow;
26987  }
26988 #else
26989  {
26990  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
26991  if (unlikely(result < 0))
26992  return (long) -1;
26993  if (unlikely(result == 1))
26994  goto raise_neg_overflow;
26995  }
26996 #endif
26997  if (sizeof(long) <= sizeof(unsigned long)) {
26998  __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
26999 #ifdef HAVE_LONG_LONG
27000  } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
27001  __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
27002 #endif
27003  }
27004  } else {
27005 #if CYTHON_USE_PYLONG_INTERNALS
27006  const digit* digits = ((PyLongObject*)x)->ob_digit;
27007  switch (Py_SIZE(x)) {
27008  case 0: return (long) 0;
27009  case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
27010  case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
27011  case -2:
27012  if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
27013  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
27014  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27015  } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
27016  return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
27017  }
27018  }
27019  break;
27020  case 2:
27021  if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
27022  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
27023  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27024  } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
27025  return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
27026  }
27027  }
27028  break;
27029  case -3:
27030  if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
27031  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
27032  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27033  } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
27034  return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
27035  }
27036  }
27037  break;
27038  case 3:
27039  if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
27040  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
27041  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27042  } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
27043  return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
27044  }
27045  }
27046  break;
27047  case -4:
27048  if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
27049  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
27050  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27051  } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
27052  return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
27053  }
27054  }
27055  break;
27056  case 4:
27057  if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
27058  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
27059  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27060  } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
27061  return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
27062  }
27063  }
27064  break;
27065  }
27066 #endif
27067  if (sizeof(long) <= sizeof(long)) {
27068  __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
27069 #ifdef HAVE_LONG_LONG
27070  } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
27071  __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
27072 #endif
27073  }
27074  }
27075  {
27076 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
27077  PyErr_SetString(PyExc_RuntimeError,
27078  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
27079 #else
27080  long val;
27081  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
27082  #if PY_MAJOR_VERSION < 3
27083  if (likely(v) && !PyLong_Check(v)) {
27084  PyObject *tmp = v;
27085  v = PyNumber_Long(tmp);
27086  Py_DECREF(tmp);
27087  }
27088  #endif
27089  if (likely(v)) {
27090  int one = 1; int is_little = (int)*(unsigned char *)&one;
27091  unsigned char *bytes = (unsigned char *)&val;
27092  int ret = _PyLong_AsByteArray((PyLongObject *)v,
27093  bytes, sizeof(val),
27094  is_little, !is_unsigned);
27095  Py_DECREF(v);
27096  if (likely(!ret))
27097  return val;
27098  }
27099 #endif
27100  return (long) -1;
27101  }
27102  } else {
27103  long val;
27104  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
27105  if (!tmp) return (long) -1;
27106  val = __Pyx_PyInt_As_long(tmp);
27107  Py_DECREF(tmp);
27108  return val;
27109  }
27110 raise_overflow:
27111  PyErr_SetString(PyExc_OverflowError,
27112  "value too large to convert to long");
27113  return (long) -1;
27114 raise_neg_overflow:
27115  PyErr_SetString(PyExc_OverflowError,
27116  "can't convert negative value to long");
27117  return (long) -1;
27118 }
27119 
27120 /* CheckBinaryVersion */
27121  static int __Pyx_check_binary_version(void) {
27122  char ctversion[4], rtversion[4];
27123  PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
27124  PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
27125  if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
27126  char message[200];
27127  PyOS_snprintf(message, sizeof(message),
27128  "compiletime version %s of module '%.100s' "
27129  "does not match runtime version %s",
27130  ctversion, __Pyx_MODULE_NAME, rtversion);
27131  return PyErr_WarnEx(NULL, message, 1);
27132  }
27133  return 0;
27134 }
27135 
27136 /* ModuleImport */
27137  #ifndef __PYX_HAVE_RT_ImportModule
27138 #define __PYX_HAVE_RT_ImportModule
27139 static PyObject *__Pyx_ImportModule(const char *name) {
27140  PyObject *py_name = 0;
27141  PyObject *py_module = 0;
27142  py_name = __Pyx_PyIdentifier_FromString(name);
27143  if (!py_name)
27144  goto bad;
27145  py_module = PyImport_Import(py_name);
27146  Py_DECREF(py_name);
27147  return py_module;
27148 bad:
27149  Py_XDECREF(py_name);
27150  return 0;
27151 }
27152 #endif
27153 
27154 /* TypeImport */
27155  #ifndef __PYX_HAVE_RT_ImportType
27156 #define __PYX_HAVE_RT_ImportType
27157 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
27158  size_t size, int strict)
27159 {
27160  PyObject *py_module = 0;
27161  PyObject *result = 0;
27162  PyObject *py_name = 0;
27163  char warning[200];
27164  Py_ssize_t basicsize;
27165 #ifdef Py_LIMITED_API
27166  PyObject *py_basicsize;
27167 #endif
27168  py_module = __Pyx_ImportModule(module_name);
27169  if (!py_module)
27170  goto bad;
27171  py_name = __Pyx_PyIdentifier_FromString(class_name);
27172  if (!py_name)
27173  goto bad;
27174  result = PyObject_GetAttr(py_module, py_name);
27175  Py_DECREF(py_name);
27176  py_name = 0;
27177  Py_DECREF(py_module);
27178  py_module = 0;
27179  if (!result)
27180  goto bad;
27181  if (!PyType_Check(result)) {
27182  PyErr_Format(PyExc_TypeError,
27183  "%.200s.%.200s is not a type object",
27184  module_name, class_name);
27185  goto bad;
27186  }
27187 #ifndef Py_LIMITED_API
27188  basicsize = ((PyTypeObject *)result)->tp_basicsize;
27189 #else
27190  py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
27191  if (!py_basicsize)
27192  goto bad;
27193  basicsize = PyLong_AsSsize_t(py_basicsize);
27194  Py_DECREF(py_basicsize);
27195  py_basicsize = 0;
27196  if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
27197  goto bad;
27198 #endif
27199  if (!strict && (size_t)basicsize > size) {
27200  PyOS_snprintf(warning, sizeof(warning),
27201  "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd",
27202  module_name, class_name, basicsize, size);
27203  if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
27204  }
27205  else if ((size_t)basicsize != size) {
27206  PyErr_Format(PyExc_ValueError,
27207  "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd",
27208  module_name, class_name, basicsize, size);
27209  goto bad;
27210  }
27211  return (PyTypeObject *)result;
27212 bad:
27213  Py_XDECREF(py_module);
27214  Py_XDECREF(result);
27215  return NULL;
27216 }
27217 #endif
27218 
27219 /* InitStrings */
27220  static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
27221  while (t->p) {
27222  #if PY_MAJOR_VERSION < 3
27223  if (t->is_unicode) {
27224  *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
27225  } else if (t->intern) {
27226  *t->p = PyString_InternFromString(t->s);
27227  } else {
27228  *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
27229  }
27230  #else
27231  if (t->is_unicode | t->is_str) {
27232  if (t->intern) {
27233  *t->p = PyUnicode_InternFromString(t->s);
27234  } else if (t->encoding) {
27235  *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
27236  } else {
27237  *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
27238  }
27239  } else {
27240  *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
27241  }
27242  #endif
27243  if (!*t->p)
27244  return -1;
27245  ++t;
27246  }
27247  return 0;
27248 }
27249 
27250 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
27251  return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
27252 }
27253 static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
27254  Py_ssize_t ignore;
27255  return __Pyx_PyObject_AsStringAndSize(o, &ignore);
27256 }
27257 static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
27258 #if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
27259  if (
27260 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
27261  __Pyx_sys_getdefaultencoding_not_ascii &&
27262 #endif
27263  PyUnicode_Check(o)) {
27264 #if PY_VERSION_HEX < 0x03030000
27265  char* defenc_c;
27266  PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
27267  if (!defenc) return NULL;
27268  defenc_c = PyBytes_AS_STRING(defenc);
27269 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
27270  {
27271  char* end = defenc_c + PyBytes_GET_SIZE(defenc);
27272  char* c;
27273  for (c = defenc_c; c < end; c++) {
27274  if ((unsigned char) (*c) >= 128) {
27275  PyUnicode_AsASCIIString(o);
27276  return NULL;
27277  }
27278  }
27279  }
27280 #endif
27281  *length = PyBytes_GET_SIZE(defenc);
27282  return defenc_c;
27283 #else
27284  if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
27285 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
27286  if (PyUnicode_IS_ASCII(o)) {
27287  *length = PyUnicode_GET_LENGTH(o);
27288  return PyUnicode_AsUTF8(o);
27289  } else {
27290  PyUnicode_AsASCIIString(o);
27291  return NULL;
27292  }
27293 #else
27294  return PyUnicode_AsUTF8AndSize(o, length);
27295 #endif
27296 #endif
27297  } else
27298 #endif
27299 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
27300  if (PyByteArray_Check(o)) {
27301  *length = PyByteArray_GET_SIZE(o);
27302  return PyByteArray_AS_STRING(o);
27303  } else
27304 #endif
27305  {
27306  char* result;
27307  int r = PyBytes_AsStringAndSize(o, &result, length);
27308  if (unlikely(r < 0)) {
27309  return NULL;
27310  } else {
27311  return result;
27312  }
27313  }
27314 }
27315 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
27316  int is_true = x == Py_True;
27317  if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
27318  else return PyObject_IsTrue(x);
27319 }
27320 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
27321 #if CYTHON_USE_TYPE_SLOTS
27322  PyNumberMethods *m;
27323 #endif
27324  const char *name = NULL;
27325  PyObject *res = NULL;
27326 #if PY_MAJOR_VERSION < 3
27327  if (PyInt_Check(x) || PyLong_Check(x))
27328 #else
27329  if (PyLong_Check(x))
27330 #endif
27331  return __Pyx_NewRef(x);
27332 #if CYTHON_USE_TYPE_SLOTS
27333  m = Py_TYPE(x)->tp_as_number;
27334  #if PY_MAJOR_VERSION < 3
27335  if (m && m->nb_int) {
27336  name = "int";
27337  res = PyNumber_Int(x);
27338  }
27339  else if (m && m->nb_long) {
27340  name = "long";
27341  res = PyNumber_Long(x);
27342  }
27343  #else
27344  if (m && m->nb_int) {
27345  name = "int";
27346  res = PyNumber_Long(x);
27347  }
27348  #endif
27349 #else
27350  res = PyNumber_Int(x);
27351 #endif
27352  if (res) {
27353 #if PY_MAJOR_VERSION < 3
27354  if (!PyInt_Check(res) && !PyLong_Check(res)) {
27355 #else
27356  if (!PyLong_Check(res)) {
27357 #endif
27358  PyErr_Format(PyExc_TypeError,
27359  "__%.4s__ returned non-%.4s (type %.200s)",
27360  name, name, Py_TYPE(res)->tp_name);
27361  Py_DECREF(res);
27362  return NULL;
27363  }
27364  }
27365  else if (!PyErr_Occurred()) {
27366  PyErr_SetString(PyExc_TypeError,
27367  "an integer is required");
27368  }
27369  return res;
27370 }
27371 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
27372  Py_ssize_t ival;
27373  PyObject *x;
27374 #if PY_MAJOR_VERSION < 3
27375  if (likely(PyInt_CheckExact(b))) {
27376  if (sizeof(Py_ssize_t) >= sizeof(long))
27377  return PyInt_AS_LONG(b);
27378  else
27379  return PyInt_AsSsize_t(x);
27380  }
27381 #endif
27382  if (likely(PyLong_CheckExact(b))) {
27383  #if CYTHON_USE_PYLONG_INTERNALS
27384  const digit* digits = ((PyLongObject*)b)->ob_digit;
27385  const Py_ssize_t size = Py_SIZE(b);
27386  if (likely(__Pyx_sst_abs(size) <= 1)) {
27387  ival = likely(size) ? digits[0] : 0;
27388  if (size == -1) ival = -ival;
27389  return ival;
27390  } else {
27391  switch (size) {
27392  case 2:
27393  if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
27394  return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27395  }
27396  break;
27397  case -2:
27398  if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
27399  return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27400  }
27401  break;
27402  case 3:
27403  if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
27404  return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27405  }
27406  break;
27407  case -3:
27408  if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
27409  return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27410  }
27411  break;
27412  case 4:
27413  if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
27414  return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27415  }
27416  break;
27417  case -4:
27418  if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
27419  return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27420  }
27421  break;
27422  }
27423  }
27424  #endif
27425  return PyLong_AsSsize_t(b);
27426  }
27427  x = PyNumber_Index(b);
27428  if (!x) return -1;
27429  ival = PyInt_AsSsize_t(x);
27430  Py_DECREF(x);
27431  return ival;
27432 }
27433 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
27434  return PyInt_FromSize_t(ival);
27435 }
27436 
27437 
27438 #endif /* Py_PYTHON_H */
double f(double C, double b, double a, int q, int r)
#define PyMODINIT_FUNC